📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -23,8 +23,7 @@
|
||||
|
||||
package com.iluwatar.resource.acquisition.is.initialization;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Resource Acquisition Is Initialization pattern was developed for exception safe resource
|
||||
@ -45,10 +44,9 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* <p>http://docs.oracle.com/javase/7/docs/technotes/guides/language/try-with-resources.html
|
||||
*/
|
||||
@Slf4j
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*/
|
||||
|
@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.resource.acquisition.is.initialization;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* SlidingDoor resource.
|
||||
*/
|
||||
@Slf4j
|
||||
public class SlidingDoor implements AutoCloseable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SlidingDoor.class);
|
||||
|
||||
public SlidingDoor() {
|
||||
LOGGER.info("Sliding door opens.");
|
||||
}
|
||||
|
@ -24,16 +24,14 @@
|
||||
package com.iluwatar.resource.acquisition.is.initialization;
|
||||
|
||||
import java.io.Closeable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* TreasureChest resource.
|
||||
*/
|
||||
@Slf4j
|
||||
public class TreasureChest implements Closeable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TreasureChest.class);
|
||||
|
||||
public TreasureChest() {
|
||||
LOGGER.info("Treasure chest opens.");
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class ClosableTest {
|
||||
class ClosableTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
|
||||
@ -55,7 +55,7 @@ public class ClosableTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenClose() {
|
||||
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