Fix checkstyle validations

This commit is contained in:
Tschis
2017-11-07 22:19:10 -03:00
parent d37922bf82
commit 3634b3338c
2 changed files with 25 additions and 26 deletions

View File

@ -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() {} private FactoryMaker() {
}
public enum KingdomType { public enum KingdomType {
ELF, ELF, ORC
ORC }
}
public static KingdomFactory makeFactory(KingdomType type) { /**
* The factory of kingdom factories.
switch (type) { */
case ELF: public static KingdomFactory makeFactory(KingdomType type) {
return new ElfKingdomFactory(); switch (type) {
case ORC: case ELF:
return new OrcKingdomFactory(); return new ElfKingdomFactory();
default: case ORC:
throw new IllegalArgumentException("KingdomType not supported."); 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

View File

@ -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
*/ */