* Initializes statics.
*/
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
saveLevel = logger.getLevel();
logger.setLevel(Level.INFO);
}
@AfterAll
- public static void tearDownAfterClass() {
+ static void tearDownAfterClass() {
logger.setLevel(saveLevel);
appender.stop();
}
* Initializes mocks and a listener.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
appender.clearExtractions();
primary = new JsonListener() {
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
logger.detachAppender(appender);
}
* Initializes statics.
*/
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
saveLevel = logger.getLevel();
logger.setLevel(Level.INFO);
}
@AfterAll
- public static void tearDownAfterClass() {
+ static void tearDownAfterClass() {
logger.setLevel(saveLevel);
appender.stop();
}
*/
@BeforeEach
@SuppressWarnings("unchecked")
- public void setUp() {
+ void setUp() {
appender.clearExtractions();
secondary1 = mock(ScoListener.class);
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
logger.detachAppender(appender);
}
* Initializes statics.
*/
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
saveLevel = logger.getLevel();
logger.setLevel(Level.INFO);
}
@AfterAll
- public static void tearDownAfterClass() {
+ static void tearDownAfterClass() {
logger.setLevel(saveLevel);
appender.stop();
}
* Create various mocks and primary handler.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
appender.clearExtractions();
primary = new ScoListener<MyMessage>(MyMessage.class) {
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
logger.detachAppender(appender);
}
private static Gson gson;
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
strategy = new JacksonExclusionStrategy();
gson = new GsonBuilder().setExclusionStrategies(strategy).create();
}
private Data dataField;
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
saveFactory = (Factory) ReflectionTestUtils.getField(Adapter.class, FACTORY_FIELD);
}
}
// has a param - shouldn't be serialized
+ @SuppressWarnings("unused")
public int getWithParams(String text) {
return 1000;
}
* Destroys all managed topics.
*/
@AfterEach
- public void tearDown() {
+ void tearDown() {
NoopTopicFactories.getSinkFactory().destroy();
NoopTopicFactories.getSourceFactory().destroy();
KafkaTopicFactories.getSinkFactory().destroy();
}
@AfterEach
- public void tearDown() throws Exception {
+ void tearDown() throws Exception {
closeable.close();
}
KafkaConsumerWrapper kafkaConsumerWrapper = new KafkaConsumerWrapper(makeKafkaBuilder().build());
kafkaConsumerWrapper.consumer = mockedKafkaConsumer;
- when(mockedKafkaConsumer.poll(any())).thenReturn(new ConsumerRecords<>(Collections.emptyMap()));
+ when(mockedKafkaConsumer.poll(any())).thenReturn(ConsumerRecords.empty());
Iterable<String> result = kafkaConsumerWrapper.fetch();
}
@Test
+ @SuppressWarnings("deprecation")
void testFetchWithMessages() {
// Setup
KafkaConsumerWrapper kafkaConsumerWrapper = new KafkaConsumerWrapper(makeKafkaBuilder().build());
}
@Test
+ @SuppressWarnings("deprecation")
void testFetchWithMessagesAndTraceParent() {
// Setup
KafkaConsumerWrapper kafkaConsumerWrapper = new KafkaConsumerWrapper(makeKafkaBuilder().build());
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
sink.shutdown();
}
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
source.shutdown();
}
List<T> lst = buildTopics(builder.build());
assertEquals(4, lst.size());
- int index = 0;
- T item = lst.get(index++);
- assertNotSame(item, lst.get(index++));
- assertSame(item, lst.get(index++));
- assertSame(item, lst.get(index++));
+ T item = lst.get(0);
+ assertNotSame(item, lst.get(1));
+ assertSame(item, lst.get(2));
+ assertSame(item, lst.get(3));
}
/**
List<T> lst = buildTopics(makePropBuilder().makeTopic(MY_TOPIC).makeTopic(TOPIC2).build());
- int index = 0;
- T item1 = lst.get(index++);
- T item2 = lst.get(index++);
+ T item1 = lst.get(0);
+ T item2 = lst.get(1);
assertEquals(2, getInventory().size());
assertTrue(getInventory().contains(item1));
List<T> lst = buildTopics(makePropBuilder().makeTopic(MY_TOPIC).makeTopic(TOPIC2).build());
- int index = 0;
- T item1 = lst.get(index++);
- T item2 = lst.get(index++);
+ T item1 = lst.get(0);
+ T item2 = lst.get(1);
item1.start();
item2.start();
* @throws Exception if an error occurs
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
sink = mock(TopicSink.class);
when(sink.send(anyString())).thenReturn(true);
}
@AfterAll
- public static void tearDown() {
+ static void tearDown() {
// clear all topics after the tests
TopicEndpointManager.getManager().shutdown();
}
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
sink.shutdown();
}
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
factory.destroy();
}
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
factory.destroy();
}
}
@AfterEach
- public void tearDown() {
+ void tearDown() {
source.shutdown();
}
// duplicate - should be the same, as these topics are managed
List<String> randomServers = new ArrayList<>();
- randomServers.add(RandomStringUtils.randomAlphanumeric(8));
+ randomServers.add(RandomStringUtils.secure().nextAlphanumeric(8));
T item3 = buildTopic(randomServers, TOPIC2, true);
assertSame(item2, item3);
private NetLoggerFeatureApi featureApi;
@BeforeEach
- public void setUp() {
+ void setUp() {
featureApi = new NetLoggerFeatureApi() {
@Override
public boolean beforeLog(Logger eventLogger, EventType type, CommInfrastructure protocol, String topic,
* Obtains the test implementation of NetLoggerFeatureApi.
*/
@BeforeAll
- public static void setUp() {
+ static void setUp() {
netLoggerFeature = (NetLoggerFeature) NetLoggerFeatureProviders.getProviders().getList().get(0);
}
* Clears events list and resets return/exceptions flags before invoking every unit test.
*/
@BeforeEach
- public void reset() {
+ void reset() {
TestAppender.clear();
netLoggerFeature.setReturnValue(false, false);
netLoggerFeature.setExceptions(false, false);
protected TopicParamsBuilder builder;
@BeforeEach
- public void setUp() {
+ void setUp() {
addProps = new TreeMap<>();
addProps.put("my-key-A", "my-value-A");
addProps.put("my-key-B", "my-value-B");
static ImplicitJoinColumnNameSource source;
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
strategy = new CustomImplicitNamingStrategy();
source = mock(ImplicitJoinColumnNameSource.class);
}
* @throws Exception if an error occurs
*/
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
sco = new StandardCoderObject(gson.fromJson(JSON, JsonElement.class));
}
private StandardCoder coder;
@BeforeEach
- public void setUp() {
+ void setUp() {
coder = new StandardCoder();
}
private Container cont;
@BeforeEach
- public void setUp() throws CoderException {
+ void setUp() throws CoderException {
coder = new StandardYamlCoder();
cont = coder.decode(YAML_FILE, Container.class);
}
* @throws IOException if an error occurs
*/
@BeforeEach
- public void setUp() throws IOException {
+ void setUp() throws IOException {
translator = new YamlJsonTranslator();
try (FileReader rdr = new FileReader(YAML_FILE)) {
private GsonTestUtils utils;
@BeforeEach
- public void setUp() {
+ void setUp() {
utils = new MyBuilder().build();
}
private GsonTestUtils utils;
@BeforeEach
- public void setUp() {
+ void setUp() {
utils = new GsonTestUtils();
}
* Initializes {@link #utils}.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
Properties properties = new Properties();
properties.put("myPrefix.my-string", "some text");
properties.put("myPrefix.empty-string", "");
* @throws IOException Signals that an I/O exception has occurred.
*/
@BeforeEach
- public void setupResourceUtilsTest() throws IOException {
+ void setupResourceUtilsTest() throws IOException {
tmpDir = new File(System.getProperty("java.io.tmpdir"));
tmpEmptyFile = File.createTempFile(this.getClass().getName(), ".tmp");
tmpUsedFile = File.createTempFile(this.getClass().getName(), ".tmp");
* Clean resource utils test.
*/
@AfterEach
- public void cleanDownResourceUtilsTest() {
+ void cleanDownResourceUtilsTest() {
assertTrue(tmpEmptyFile.delete());
assertTrue(tmpUsedFile.delete());
}
* Initializes fields.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
tried = new LinkedList<>();
errors = new LinkedList<>();
pred = new MyPred();
* Saves the original state of the ordered service list to restore after each test.
*/
@BeforeAll
- public static void setup() {
+ static void setup() {
List<GenericService> implementers = GenericService.providers.getList();
highPrioService = implementers.get(0);
lowPrioService = implementers.get(1);
* Restores original state after each test.
*/
@BeforeEach
- public void resetOrder() {
+ void resetOrder() {
highPrioService.setSequenceNumber(HIGH_PRIORITY_NUM);
lowPrioService.setSequenceNumber(LOW_PRIORITY_NUM);
}
}
-}
\ No newline at end of file
+}
* Set up.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
starter = mock(RunnableWithEx.class);
stopper = mock(RunnableWithEx.class);
startObj = mock(Startable.class);
* Initializes {@link #svcmgr}.
*/
@BeforeEach
- public void setUp() {
+ void setUp() {
svcmgr = new ServiceManager(MY_NAME);
}
public static class NoConstructorsException extends Exception {
private static final long serialVersionUID = 1L;
+ @SuppressWarnings("unused")
public NoConstructorsException(int value) {
super();
}
public static class NoConstructorsThrowable extends Throwable {
private static final long serialVersionUID = 1L;
+ @SuppressWarnings("unused")
public NoConstructorsThrowable(int value) {
super();
}
private List<Thread> threads;
@BeforeAll
- public static void setUpBeforeClass() {
+ static void setUpBeforeClass() {
logger = (Logger) LoggerFactory.getLogger(ExtractAppenderTest.class);
logger.setLevel(Level.INFO);
}
@BeforeEach
- public void setUp() {
+ void setUp() {
threads = new LinkedList<>();
}
* Tear down all appenders and threads.
*/
@AfterEach
- public void tearDown() throws Exception {
+ void tearDown() throws Exception {
logger.detachAndStopAllAppenders();
for (Thread p : threads) {
private Version vers;
@BeforeEach
- public void setUp() {
+ void setUp() {
vers = new Version(MAJOR, MINOR, PATCH);
}