📍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:
@ -42,24 +42,24 @@ public interface Potion {
|
||||
void drink();
|
||||
}
|
||||
|
||||
@Slf4j
|
||||
public class HealingPotion implements Potion {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HealingPotion.class);
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You feel healed. (Potion={})", System.identityHashCode(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Slf4j
|
||||
public class HolyWaterPotion implements Potion {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HolyWaterPotion.class);
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You feel blessed. (Potion={})", System.identityHashCode(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Slf4j
|
||||
public class InvisibilityPotion implements Potion {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(InvisibilityPotion.class);
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You become invisible. (Potion={})", System.identityHashCode(this));
|
||||
|
@ -24,16 +24,14 @@
|
||||
package com.iluwatar.flyweight;
|
||||
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* AlchemistShop holds potions on its shelves. It uses PotionFactory to provide the potions.
|
||||
*/
|
||||
@Slf4j
|
||||
public class AlchemistShop {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AlchemistShop.class);
|
||||
|
||||
private final List<Potion> topShelf;
|
||||
private final List<Potion> bottomShelf;
|
||||
|
||||
|
@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.flyweight;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* HealingPotion.
|
||||
*/
|
||||
@Slf4j
|
||||
public class HealingPotion implements Potion {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HealingPotion.class);
|
||||
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You feel healed. (Potion={})", System.identityHashCode(this));
|
||||
|
@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.flyweight;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* HolyWaterPotion.
|
||||
*/
|
||||
@Slf4j
|
||||
public class HolyWaterPotion implements Potion {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HolyWaterPotion.class);
|
||||
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You feel blessed. (Potion={})", System.identityHashCode(this));
|
||||
|
@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.flyweight;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* InvisibilityPotion.
|
||||
*/
|
||||
@Slf4j
|
||||
public class InvisibilityPotion implements Potion {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(InvisibilityPotion.class);
|
||||
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You become invisible. (Potion={})", System.identityHashCode(this));
|
||||
|
@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.flyweight;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* PoisonPotion.
|
||||
*/
|
||||
@Slf4j
|
||||
public class PoisonPotion implements Potion {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PoisonPotion.class);
|
||||
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("Urgh! This is poisonous. (Potion={})", System.identityHashCode(this));
|
||||
|
@ -23,16 +23,14 @@
|
||||
|
||||
package com.iluwatar.flyweight;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* StrengthPotion.
|
||||
*/
|
||||
@Slf4j
|
||||
public class StrengthPotion implements Potion {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StrengthPotion.class);
|
||||
|
||||
@Override
|
||||
public void drink() {
|
||||
LOGGER.info("You feel strong. (Potion={})", System.identityHashCode(this));
|
||||
|
@ -37,7 +37,7 @@ import org.junit.jupiter.api.Test;
|
||||
public class AlchemistShopTest {
|
||||
|
||||
@Test
|
||||
public void testShop() {
|
||||
void testShop() {
|
||||
final var shop = new AlchemistShop();
|
||||
|
||||
final var bottomShelf = shop.getBottomShelf();
|
||||
|
Reference in New Issue
Block a user