remove lombok, related to #1503

This commit is contained in:
Vladislav Golubinov 2020-09-06 11:42:39 +03:00
parent bd48d6ce10
commit 2e36a11e24
4 changed files with 51 additions and 30 deletions

View File

@ -31,11 +31,6 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -23,8 +23,10 @@
package com.iluwatar.abstractfactory;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* The Abstract Factory pattern provides a way to encapsulate a group of individual factories that
@ -40,12 +42,16 @@ import lombok.extern.slf4j.Slf4j;
* and its implementations ( {@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses
* both concrete implementations to create a king, a castle and an army.
*/
@Slf4j
public class App implements Runnable {
@Getter
private static Logger log = LoggerFactory.getLogger(App.class);
private final Kingdom kingdom = new Kingdom();
public Kingdom getKingdom() {
return kingdom;
}
/**
* Program entry point.
*

View File

@ -1,14 +1,35 @@
package com.iluwatar.abstractfactory;
import lombok.Data;
@Data
public class Kingdom {
private King king;
private Castle castle;
private Army army;
public King getKing() {
return king;
}
public Castle getCastle() {
return castle;
}
public Army getArmy() {
return army;
}
public void setKing(King king) {
this.king = king;
}
public void setCastle(Castle castle) {
this.castle = castle;
}
public void setArmy(Army army) {
this.army = army;
}
/**
* The factory of kingdom factories.
*/

View File

@ -23,7 +23,6 @@
package com.iluwatar.abstractfactory;
import lombok.val;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -48,14 +47,14 @@ public class AbstractFactoryTest {
@Test
public void king() {
app.createKingdom(elfFactory);
val kingdom = app.getKingdom();
final var kingdom = app.getKingdom();
val elfKing = kingdom.getKing();
final var elfKing = kingdom.getKing();
assertTrue(elfKing instanceof ElfKing);
assertEquals(ElfKing.DESCRIPTION, elfKing.getDescription());
app.createKingdom(orcFactory);
val orcKing = kingdom.getKing();
final var orcKing = kingdom.getKing();
assertTrue(orcKing instanceof OrcKing);
assertEquals(OrcKing.DESCRIPTION, orcKing.getDescription());
}
@ -63,14 +62,14 @@ public class AbstractFactoryTest {
@Test
public void castle() {
app.createKingdom(elfFactory);
val kingdom = app.getKingdom();
final var kingdom = app.getKingdom();
val elfCastle = kingdom.getCastle();
final var elfCastle = kingdom.getCastle();
assertTrue(elfCastle instanceof ElfCastle);
assertEquals(ElfCastle.DESCRIPTION, elfCastle.getDescription());
app.createKingdom(orcFactory);
val orcCastle = kingdom.getCastle();
final var orcCastle = kingdom.getCastle();
assertTrue(orcCastle instanceof OrcCastle);
assertEquals(OrcCastle.DESCRIPTION, orcCastle.getDescription());
}
@ -78,14 +77,14 @@ public class AbstractFactoryTest {
@Test
public void army() {
app.createKingdom(elfFactory);
val kingdom = app.getKingdom();
final var kingdom = app.getKingdom();
val elfArmy = kingdom.getArmy();
final var elfArmy = kingdom.getArmy();
assertTrue(elfArmy instanceof ElfArmy);
assertEquals(ElfArmy.DESCRIPTION, elfArmy.getDescription());
app.createKingdom(orcFactory);
val orcArmy = kingdom.getArmy();
final var orcArmy = kingdom.getArmy();
assertTrue(orcArmy instanceof OrcArmy);
assertEquals(OrcArmy.DESCRIPTION, orcArmy.getDescription());
}
@ -93,11 +92,11 @@ public class AbstractFactoryTest {
@Test
public void createElfKingdom() {
app.createKingdom(elfFactory);
val kingdom = app.getKingdom();
final var kingdom = app.getKingdom();
val king = kingdom.getKing();
val castle = kingdom.getCastle();
val army = kingdom.getArmy();
final var king = kingdom.getKing();
final var castle = kingdom.getCastle();
final var army = kingdom.getArmy();
assertTrue(king instanceof ElfKing);
assertEquals(ElfKing.DESCRIPTION, king.getDescription());
assertTrue(castle instanceof ElfCastle);
@ -109,11 +108,11 @@ public class AbstractFactoryTest {
@Test
public void createOrcKingdom() {
app.createKingdom(orcFactory);
val kingdom = app.getKingdom();
final var kingdom = app.getKingdom();
val king = kingdom.getKing();
val castle = kingdom.getCastle();
val army = kingdom.getArmy();
final var king = kingdom.getKing();
final var castle = kingdom.getCastle();
final var army = kingdom.getArmy();
assertTrue(king instanceof OrcKing);
assertEquals(OrcKing.DESCRIPTION, king.getDescription());
assertTrue(castle instanceof OrcCastle);