Java 11 migrate remaining q-r (#1121)
* Moves queue-load-leveling to Java 11 * Moves reactor to Java 11 * Moves reader-writer-lock to Java 11 * Moves repository to Java 11 * Moves resource-acquisition-is-initialization to Java 11 * Moves retry to Java 11 * Moves role-object to Java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
cd2a2e7711
commit
20ea465b7f
@ -54,11 +54,11 @@ public class App {
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
try (SlidingDoor slidingDoor = new SlidingDoor()) {
|
||||
try (var ignored = new SlidingDoor()) {
|
||||
LOGGER.info("Walking in.");
|
||||
}
|
||||
|
||||
try (TreasureChest treasureChest = new TreasureChest()) {
|
||||
try (var ignored = new TreasureChest()) {
|
||||
LOGGER.info("Looting contents.");
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class SlidingDoor implements AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() {
|
||||
LOGGER.info("Sliding door closes.");
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
package com.iluwatar.resource.acquisition.is.initialization;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -40,7 +39,7 @@ public class TreasureChest implements Closeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
LOGGER.info("Treasure chest closes.");
|
||||
}
|
||||
}
|
||||
|
@ -26,15 +26,12 @@ package com.iluwatar.resource.acquisition.is.initialization;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
String[] args = {};
|
||||
App.main(args);
|
||||
App.main(new String[]{});
|
||||
}
|
||||
}
|
||||
|
@ -23,19 +23,18 @@
|
||||
|
||||
package com.iluwatar.resource.acquisition.is.initialization;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Date: 12/28/15 - 9:31 PM
|
||||
*
|
||||
@ -56,8 +55,8 @@ public class ClosableTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenClose() throws Exception {
|
||||
try (final SlidingDoor door = new SlidingDoor(); final TreasureChest chest = new TreasureChest()) {
|
||||
public void testOpenClose() {
|
||||
try (final var ignored = new SlidingDoor(); final var ignored1 = new TreasureChest()) {
|
||||
assertTrue(appender.logContains("Sliding door opens."));
|
||||
assertTrue(appender.logContains("Treasure chest opens."));
|
||||
}
|
||||
|
Reference in New Issue
Block a user