Skip to content

Commit b0e5e5f

Browse files
committed
Fixed after Codacy review
1 parent 3a548ef commit b0e5e5f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/main/java/com/mapcode/UnknownTerritoryException.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.mapcode;
1818

1919
import javax.annotation.Nonnull;
20+
import javax.annotation.Nullable;
2021

2122
/**
2223
* This runtime exception is thrown for unknown territory codes. It is specifically a runtime exception, because
@@ -37,4 +38,9 @@ public UnknownTerritoryException(final int code) {
3738
super();
3839
this.code = code;
3940
}
41+
42+
@Nullable
43+
public Integer getCode() {
44+
return code;
45+
}
4046
}

src/test/java/com/mapcode/EncodeDecodeTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import java.util.concurrent.TimeUnit;
2828
import java.util.concurrent.atomic.AtomicInteger;
2929

30+
import static junit.framework.TestCase.assertFalse;
3031
import static org.junit.Assert.assertEquals;
31-
import static org.junit.Assert.assertTrue;
3232

3333
@SuppressWarnings({"OverlyBroadThrowsClause", "ProhibitedExceptionDeclared"})
3434
public class EncodeDecodeTest {
@@ -75,7 +75,7 @@ private static void doEncodeDecode(final long seed) throws InterruptedException
7575

7676
// Check encodeToShortest and encodeToInternational.
7777
final List<Mapcode> resultsAll = MapcodeCodec.encode(latDeg, lonDeg);
78-
assertTrue(!resultsAll.isEmpty());
78+
assertFalse(resultsAll.isEmpty());
7979
assertEquals("encodeToInternational failed, result=" + resultsAll,
8080
resultsAll.get(resultsAll.size() - 1), mapcodeInternational);
8181

src/test/java/com/mapcode/ReferenceFileTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.concurrent.atomic.AtomicInteger;
3333
import java.util.concurrent.atomic.AtomicLong;
3434

35+
import static junit.framework.TestCase.assertFalse;
3536
import static org.junit.Assert.assertEquals;
3637
import static org.junit.Assert.assertTrue;
3738

@@ -344,7 +345,7 @@ private static ReferenceRec getNextReferenceRecord(@Nonnull final ChunkedFile ch
344345
final ArrayList<MapcodeRec> mapcodeRecs = new ArrayList<MapcodeRec>();
345346
for (int i = 0; i < count; ++i) {
346347
final String line = chunkedFile.readNonEmptyLine();
347-
assertTrue("Line should not be empty", !line.isEmpty());
348+
assertFalse("Line should not be empty", line.isEmpty());
348349

349350
final String[] mapcodeLine = line.split(" ");
350351
assertTrue("Expecting 1 or 2 elements, territory and mapcode, got: " + mapcodeLine.length + ", " + line,

0 commit comments

Comments
 (0)