Skip to content

Commit 7324084

Browse files
committed
fix checkstyle errors in tests #58
1 parent fe5ddbb commit 7324084

16 files changed

+61
-55
lines changed

src/test/java/cryptator/AdaptiveTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class AdaptiveTest {
2222

23-
public final CryptaSolvingTester t = new CryptaSolvingTester(new AdaptiveSolver());
23+
private final CryptaSolvingTester t = new CryptaSolvingTester(new AdaptiveSolver());
2424

2525
public AdaptiveTest() {
2626
}

src/test/java/cryptator/BignumTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
public class BignumTest {
2020

21-
public final CryptaSolvingTester t = new CryptaSolvingTester(new CryptaSolver(true));
21+
private final CryptaSolvingTester t = new CryptaSolvingTester(new CryptaSolver(true));
2222

2323
public BignumTest() {
2424
}

src/test/java/cryptator/CommandTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testCryptagen() throws FileNotFoundException {
4444

4545
@Test
4646
public void testCryptagenDoublyTrue() throws FileNotFoundException {
47-
String[] args = {"-c", "FALSE", "-g", "FALSE", "-v", "FALSE", "3", "4",};
47+
String[] args = {"-c", "FALSE", "-g", "FALSE", "-v", "FALSE", "3", "4"};
4848
assertEquals(0, Cryptagen.doMain(args));
4949
}
5050

src/test/java/cryptator/EngineTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
public class EngineTest {
3232

33-
public CryptaConfig config = new CryptaConfig();
33+
private CryptaConfig config = new CryptaConfig();
3434

35-
public final CryptaParserWrapper parser = new CryptaParserWrapper();
35+
private final CryptaParserWrapper parser = new CryptaParserWrapper();
3636

37-
public final CryptaModeler modeler = new CryptaModeler();
37+
private final CryptaModeler modeler = new CryptaModeler();
3838

39-
public final CryptaGameEngine engine = new CryptaGameEngine();
39+
private final CryptaGameEngine engine = new CryptaGameEngine();
4040

4141
public EngineTest() {
4242
}
@@ -77,23 +77,25 @@ public final void testInvalidDecisionsParser() {
7777
assertNull(CryptaGameDecision.parseDecision("x = x"));
7878
}
7979

80-
private void setUpEngine(String cryptarithm) throws CryptaModelException, CryptaGameException {
80+
private void setUpEngine(final String cryptarithm) throws CryptaModelException, CryptaGameException {
8181
final ICryptaNode node = parser.parse(cryptarithm);
8282
final CryptaModel model = modeler.model(node, config);
8383
engine.setUp(model);
8484
}
8585

86-
private final void testGoodDecision(char symbol, CryptaOperator reOperator, int value) throws CryptaGameException {
86+
private void testGoodDecision(final char symbol, final CryptaOperator reOperator, final int value)
87+
throws CryptaGameException {
8788
assertTrue(engine.takeDecision(new CryptaGameDecision(symbol, reOperator, value)));
8889
assertFalse(engine.isSolved());
8990
}
9091

91-
private final void testBadDecision(char symbol, CryptaOperator reOperator, int value) throws CryptaGameException {
92+
private void testBadDecision(final char symbol, final CryptaOperator reOperator, final int value)
93+
throws CryptaGameException {
9294
assertFalse(engine.takeDecision(new CryptaGameDecision(symbol, reOperator, value)));
9395
assertFalse(engine.isSolved());
9496
}
9597

96-
private final void testGoodLastDecision(char symbol, CryptaOperator reOperator, int value)
98+
private void testGoodLastDecision(final char symbol, final CryptaOperator reOperator, final int value)
9799
throws CryptaGameException {
98100
assertTrue(engine.takeDecision(new CryptaGameDecision(symbol, reOperator, value)));
99101
assertTrue(engine.isSolved());

src/test/java/cryptator/EvaluationTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,22 @@
3131

3232
public class EvaluationTest {
3333

34-
public final CryptaParserWrapper parser = new CryptaParserWrapper();
34+
private final CryptaParserWrapper parser = new CryptaParserWrapper();
3535

36-
public final ICryptaEvaluation eval = new CryptaEvaluation();
36+
private final ICryptaEvaluation eval = new CryptaEvaluation();
3737

3838
public EvaluationTest() {
3939
}
4040

41-
private void testInSolution(ICryptaSolution s, char symbol, int digit) throws CryptaSolutionException {
41+
private void testInSolution(final ICryptaSolution s, final char symbol, final int digit)
42+
throws CryptaSolutionException {
4243
assertTrue(s.hasDigit(symbol));
4344
assertTrue(s.hasDomain(symbol));
4445
assertEquals(digit, s.getDigit(symbol));
4546
assertNotNull(s.getDomain(symbol));
4647
}
4748

48-
private void testNotInSolution(ICryptaSolution s, char symbol) throws CryptaSolutionException {
49+
private void testNotInSolution(final ICryptaSolution s, final char symbol) throws CryptaSolutionException {
4950
assertFalse(s.hasDigit(symbol));
5051
assertFalse(s.hasDomain(symbol));
5152
assertNotNull(s.getDomain(symbol));
@@ -90,12 +91,12 @@ public void testInvalidSolutionParser3() throws CryptaSolutionException {
9091
CryptaSolutionMap.parseSolution("A 1 B");
9192
}
9293

93-
private void assertTrueEval(ICryptaNode cryptarithm, ICryptaSolution solution, int base)
94+
private void assertTrueEval(final ICryptaNode cryptarithm, final ICryptaSolution solution, final int base)
9495
throws CryptaEvaluationException {
9596
assertEquals(BigInteger.ONE, eval.evaluate(cryptarithm, solution, base));
9697
}
9798

98-
private void assertFalseEval(ICryptaNode cryptarithm, ICryptaSolution solution, int base)
99+
private void assertFalseEval(final ICryptaNode cryptarithm, final ICryptaSolution solution, final int base)
99100
throws CryptaEvaluationException {
100101
assertEquals(BigInteger.ZERO, eval.evaluate(cryptarithm, solution, base));
101102
}
@@ -188,7 +189,7 @@ public void testEvaluation9() throws CryptaParserException, CryptaSolutionExcept
188189
assertTrueEval(cryptarithm, solution, 4);
189190
}
190191

191-
public void testPartialSolution(String cryptarithm, String partialSolution)
192+
public void testPartialSolution(final String cryptarithm, final String partialSolution)
192193
throws CryptaParserException, CryptaSolutionException, CryptaEvaluationException {
193194
final ICryptaNode node = parser.parse(cryptarithm);
194195
final ICryptaSolution solution = CryptaSolutionMap.parseSolution(partialSolution);

src/test/java/cryptator/ExportTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
public class ExportTest {
2525

26+
private final CryptaParserWrapper parser = new CryptaParserWrapper();
27+
2628
public ExportTest() {
2729
}
2830

29-
public final CryptaParserWrapper parser = new CryptaParserWrapper();
30-
3131
@Test
3232
public void testExport1() throws CryptaParserException, CryptaSolutionException, CryptaEvaluationException {
3333
final ICryptaNode cryptarithm = parser.parse("SEND+MORE=MONEY");

src/test/java/cryptator/ExtensiveTesting.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
public class ExtensiveTesting {
2323

24-
public final CryptaSolvingTester t = new CryptaSolvingTester(new CryptaSolver(false));
24+
private final CryptaSolvingTester t = new CryptaSolvingTester(new CryptaSolver(false));
2525

2626
public ExtensiveTesting() {
2727
}

src/test/java/cryptator/Failing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
public class Failing {
2626

27-
public final CryptaSolvingTester t = new CryptaSolvingTester(new CryptaSolver(false));
27+
private final CryptaSolvingTester t = new CryptaSolvingTester(new CryptaSolver(false));
2828

2929
public Failing() {
3030
}

src/test/java/cryptator/FeaturesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
public class FeaturesTest {
2323

24-
public final CryptaParserWrapper parser = new CryptaParserWrapper();
24+
private final CryptaParserWrapper parser = new CryptaParserWrapper();
2525

2626
public FeaturesTest() {
2727
}

src/test/java/cryptator/GenModelTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ public void buildGenModels() {
3535
}
3636
}
3737

38-
private void postMaxWordCountConstraint(ICryptaGenModel model, int maxWordCount) {
38+
private void postMaxWordCountConstraint(final ICryptaGenModel model, final int maxWordCount) {
3939
model.getWordCount().le(maxWordCount).post();
4040
}
4141

42-
private void testGenModels(int expectedSolutionCount, int maxWordCount) {
42+
private void testGenModels(final int expectedSolutionCount, final int maxWordCount) {
4343
for (ICryptaGenModel m : models) {
4444
postMaxWordCountConstraint(m, maxWordCount);
4545
testGenModel(m, expectedSolutionCount);
4646
}
4747
}
4848

49-
private void testGenModel(ICryptaGenModel model, int expectedSolutionCount) {
49+
private void testGenModel(final ICryptaGenModel model, final int expectedSolutionCount) {
5050
assertEquals(expectedSolutionCount, model.getModel().getSolver().streamSolutions().count());
5151
}
5252

0 commit comments

Comments
 (0)