Fix checkstyle validations
This commit is contained in:
parent
d37922bf82
commit
3634b3338c
@ -95,33 +95,32 @@ public class App {
|
|||||||
this.army = army;
|
this.army = army;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The factory of kingdom factories.
|
|
||||||
*/
|
|
||||||
public static class FactoryMaker {
|
public static class FactoryMaker {
|
||||||
|
|
||||||
private FactoryMaker() {}
|
|
||||||
|
|
||||||
public enum KingdomType {
|
|
||||||
ELF,
|
|
||||||
ORC
|
|
||||||
}
|
|
||||||
|
|
||||||
public static KingdomFactory makeFactory(KingdomType type) {
|
|
||||||
|
|
||||||
switch (type) {
|
private FactoryMaker() {
|
||||||
case ELF:
|
}
|
||||||
return new ElfKingdomFactory();
|
|
||||||
case ORC:
|
public enum KingdomType {
|
||||||
return new OrcKingdomFactory();
|
ELF, ORC
|
||||||
default:
|
}
|
||||||
throw new IllegalArgumentException("KingdomType not supported.");
|
|
||||||
}
|
/**
|
||||||
}
|
* The factory of kingdom factories.
|
||||||
|
*/
|
||||||
|
public static KingdomFactory makeFactory(KingdomType type) {
|
||||||
|
switch (type) {
|
||||||
|
case ELF:
|
||||||
|
return new ElfKingdomFactory();
|
||||||
|
case ORC:
|
||||||
|
return new OrcKingdomFactory();
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("KingdomType not supported.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Program entry point
|
* Program entry point.
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
* command line args
|
* command line args
|
||||||
|
@ -25,12 +25,12 @@ package com.iluwatar.abstractfactory;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.iluwatar.abstractfactory.App.FactoryMaker;
|
import com.iluwatar.abstractfactory.App.FactoryMaker;
|
||||||
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
|
import com.iluwatar.abstractfactory.App.FactoryMaker.KingdomType;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for abstract factory
|
* Test for abstract factory
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user