Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove public visibility of JUnit 5 tests #3641

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ITActiveMQCollector {

ActiveMQCollector collector;

@BeforeEach public void start(TestInfo testInfo) {
@BeforeEach void start(TestInfo testInfo) {
Optional<Method> testMethod = testInfo.getTestMethod();
if (testMethod.isPresent()) {
this.testName = testMethod.get().getName();
Expand All @@ -78,7 +78,7 @@ public class ITActiveMQCollector {
collector = builder().build().start();
}

@AfterEach public void stop() throws IOException {
@AfterEach void stop() throws IOException {
activemq.stop();
collector.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static zipkin2.TestObjects.LOTS_OF_SPANS;

public class CollectorSamplerTest {
class CollectorSamplerTest {

/**
* Math.abs("8000000000000000") returns a negative, we coerse to "7fffffffffffffff" to avoid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public class CollectorTest {
Collector collector;
private TestLogger testLogger = TestLoggerFactory.getTestLogger("");

@BeforeEach public void setup() {
@BeforeEach void setup() {
testLogger.clearAll();
collector = spy(
new Collector.Builder(testLogger).metrics(metrics).storage(storage).build());
when(collector.idString(CLIENT_SPAN)).thenReturn("1"); // to make expectations easier to read
}

@AfterEach public void after() {
@AfterEach void after() {
verifyNoMoreInteractions(metrics, callback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class RabbitMQCollectorTest {
class RabbitMQCollectorTest {

RabbitMQCollector collector;

@BeforeEach public void before() {
@BeforeEach void before() {
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setConnectionTimeout(100);
// We can be pretty certain RabbitMQ isn't running on localhost port 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"spring.config.name=zipkin-server"
}
)
public class ITEnableZipkinServer {
class ITEnableZipkinServer {

@Autowired Server server;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ZipkinActiveMQCollectorPropertiesOverrideTest {

AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ZipkinKafkaCollectorPropertiesOverrideTest {

AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
if (context != null) context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ZipkinRabbitMQCollectorPropertiesOverrideTest {

AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
if (context != null) context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class ZipkinScribeCollectorConfigurationTest {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"spring.config.name=zipkin-server"
}
)
public class ITActuatorMappings {
class ITActuatorMappings {
@Autowired PrometheusMeterRegistry registry;
@Autowired Server server;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@
"zipkin.collector.grpc.enabled=true"
}
)
public class ITZipkinGrpcCollector {
class ITZipkinGrpcCollector {
@Autowired InMemoryStorage storage;
@Autowired Server server;

@BeforeEach public void init() {
@BeforeEach void init() {
storage.clear();
}

OkHttpClient client = new OkHttpClient.Builder().protocols(asList(H2_PRIOR_KNOWLEDGE)).build();

ListOfSpans request;

@BeforeEach public void sanityCheckCodecCompatible() throws IOException {
@BeforeEach void sanityCheckCodecCompatible() throws IOException {
request = ListOfSpans.ADAPTER.decode(SpanBytesEncoder.PROTO3.encodeList(TestObjects.TRACE));

assertThat(SpanBytesDecoder.PROTO3.decodeList(request.encode()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ITZipkinServer {

OkHttpClient client = new OkHttpClient.Builder().followRedirects(true).build();

@BeforeEach public void init() {
@BeforeEach void init() {
storage.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"zipkin.storage.autocomplete-keys=environment,clnt/finagle.version"
}
)
public class ITZipkinServerAutocomplete {
class ITZipkinServerAutocomplete {

@Autowired Server server;
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"zipkin.query.allowed-origins=" + ITZipkinServerCORS.ALLOWED_ORIGIN
}
)
public class ITZipkinServerCORS {
class ITZipkinServerCORS {
static final String ALLOWED_ORIGIN = "http://foo.example.com";
static final String DISALLOWED_ORIGIN = "http://bar.example.com";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"zipkin.storage.type=", // cheat and test empty storage type
"zipkin.collector.http.enabled=false"
})
public class ITZipkinServerHttpCollectorDisabled {
class ITZipkinServerHttpCollectorDisabled {

@Autowired Server server;
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"zipkin.ui.enabled=false"
}
)
public class ITZipkinServerQueryDisabled {
class ITZipkinServerQueryDisabled {
@Autowired Server server;
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
"armeria.ports[0].port=${server.port}",
"armeria.ports[0].protocols[0]=http",
})
public class ITZipkinServerSsl {
class ITZipkinServerSsl {
@Autowired Server server;
@Autowired ArmeriaSettings armeriaSettings;

ClientFactory clientFactory;

@BeforeEach public void configureClientFactory() {
@BeforeEach void configureClientFactory() {
clientFactory = configureSsl(ClientFactory.builder(), armeriaSettings.getSsl()).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"spring.config.name=zipkin-server"
}
)
public class ITZipkinServerTimeout {
class ITZipkinServerTimeout {
static final List<Span> TRACE = asList(TestObjects.CLIENT_SPAN);

SlowSpanStore spanStore;
Expand All @@ -58,7 +58,7 @@ public class ITZipkinServerTimeout {

OkHttpClient client = new OkHttpClient.Builder().followRedirects(true).build();

@BeforeEach public void init() {
@BeforeEach void init() {
spanStore = new SlowSpanStore();
when(storage.spanStore()).thenReturn(spanStore);
when(storage.traces()).thenReturn(new TracesAdapter(spanStore));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import static zipkin2.server.internal.ZipkinActuatorImporter.PROPERTY_NAME_ACTUATOR_ENABLED;

// This tests actuator integration without actually requiring a compile dep on actuator
public class ZipkinActuatorImporterTest {
class ZipkinActuatorImporterTest {
ZipkinActuatorImporter zipkinActuatorImporter =
new ZipkinActuatorImporter(ActuatorImpl.class.getName());
GenericApplicationContext context = new GenericApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class ZipkinHttpConfigurationTest {
class ZipkinHttpConfigurationTest {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.GenericApplicationContext;

public class ZipkinModuleImporterTest {
class ZipkinModuleImporterTest {
ZipkinModuleImporter zipkinModuleImporter = new ZipkinModuleImporter();
GenericApplicationContext context = new GenericApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class ZipkinActiveMQCollectorConfigurationTest {
class ZipkinActiveMQCollectorConfigurationTest {

AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class ZipkinActiveMQCollectorPropertiesTest {
class ZipkinActiveMQCollectorPropertiesTest {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

/** This prevents an empty ACTIVEMQ_URL variable from being mistaken as a real one */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;

public class ZipkinBannerTest {
@AfterEach public void tearDown() {
class ZipkinBannerTest {
@AfterEach void tearDown() {
AnsiOutput.setEnabled(AnsiOutput.Enabled.DETECT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
"zipkin.self-tracing.message-timeout=100ms",
"zipkin.self-tracing.traces-per-second=100"
})
public class ITZipkinSelfTracing {
class ITZipkinSelfTracing {
@Autowired TracingStorageComponent storage;
@Autowired AsyncZipkinSpanHandler zipkinSpanHandler;
@Autowired Server server;

OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();

@BeforeEach public void clear() {
@BeforeEach void clear() {
inMemoryStorage().clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class ITElasticsearchClientInitialization {
class ITElasticsearchClientInitialization {

AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
/**
* These tests focus on http client health checks not currently in zipkin-storage-elasticsearch.
*/
public class ITElasticsearchHealthCheck {
class ITElasticsearchHealthCheck {
static final Logger logger = LoggerFactory.getLogger(ITElasticsearchHealthCheck.class.getName());
// Health check interval is 100ms, but in-flight requests in CI might take a few hundred ms
static final ConditionFactory awaitTimeout = await().timeout(1, TimeUnit.SECONDS);
Expand Down Expand Up @@ -87,7 +87,7 @@ private static HttpResponse sendResponseAfterAggregate(HttpRequest req,

AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@BeforeEach public void setUp() {
@BeforeEach void setUp() {
server1Health.setHealthy(true);
server2Health.setHealthy(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class InitialEndpointSupplierTest {
}

/** This helps ensure old setups don't break (provided they have http port 9200 open) */
@Test public void coersesPort9300To9200() {
@Test void coersesPort9300To9200() {
assertThat(new InitialEndpointSupplier(HTTP, "localhost:9300").get())
.isEqualTo(Endpoint.of("localhost", 9200));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static zipkin2.server.internal.elasticsearch.ITElasticsearchDynamicCredentials.pathOfResource;

public class ZipkinElasticsearchStorageConfigurationTest {
class ZipkinElasticsearchStorageConfigurationTest {
final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

@AfterEach public void close() {
@AfterEach void close() {
context.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class ComponentHealthTest {
class ComponentHealthTest {
@Test void addsMessageToDetails() {
ComponentHealth health = ComponentHealth.ofComponent(new Component() {
@Override public CheckResult check() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
"spring.config.name=zipkin-server"
}
)
public class ITZipkinHealth {
class ITZipkinHealth {
@Autowired InMemoryStorage storage;
@Autowired PrometheusMeterRegistry registry;
@Autowired Server server;

OkHttpClient client = new OkHttpClient.Builder().followRedirects(true).build();

@BeforeEach public void init() {
@BeforeEach void init() {
storage.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"zipkin.storage.elasticsearch.hosts=127.0.0.1:9999"
}
)
public class ITZipkinHealthDown {
class ITZipkinHealthDown {
@Autowired Server server;

OkHttpClient client = new OkHttpClient.Builder().followRedirects(true).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static zipkin2.server.internal.health.ComponentHealth.STATUS_DOWN;
import static zipkin2.server.internal.health.ComponentHealth.STATUS_UP;

public class ZipkinHealthControllerTest {
class ZipkinHealthControllerTest {
@Test void writeJsonError_writesNestedError() throws Exception {
assertThat(ZipkinHealthController.writeJsonError("robots")).isEqualTo(""
+ "{\n"
Expand Down
Loading
Loading