diff --git a/src/main/java/org/cqfn/astranaut/core/base/Position.java b/src/main/java/org/cqfn/astranaut/core/base/Position.java index c235655..391b181 100644 --- a/src/main/java/org/cqfn/astranaut/core/base/Position.java +++ b/src/main/java/org/cqfn/astranaut/core/base/Position.java @@ -51,14 +51,6 @@ public interface Position extends Comparable { */ int getColumn(); - /** - * Compares this position with the specified position for order. - * @param other The position to be compared - * @return A negative integer, zero, or a positive integer as this position is less than, - * equal to, or greater than the specified position. - * @throws IllegalArgumentException If positions are from different sources and cannot - * be compared - */ @Override default int compareTo(final Position other) { if (!this.getSource().equals(other.getSource())) { diff --git a/src/test/java/org/cqfn/astranaut/core/base/DifferenceNodeTest.java b/src/test/java/org/cqfn/astranaut/core/base/DiffNodeTest.java similarity index 89% rename from src/test/java/org/cqfn/astranaut/core/base/DifferenceNodeTest.java rename to src/test/java/org/cqfn/astranaut/core/base/DiffNodeTest.java index 519657f..d7390ec 100644 --- a/src/test/java/org/cqfn/astranaut/core/base/DifferenceNodeTest.java +++ b/src/test/java/org/cqfn/astranaut/core/base/DiffNodeTest.java @@ -36,7 +36,7 @@ * * @since 1.1.0 */ -class DifferenceNodeTest { +class DiffNodeTest { /** * The folder with test resources. */ @@ -82,12 +82,12 @@ class DifferenceNodeTest { */ @Test void testInsertGetBefore() { - final Node root = this.loadTree(DifferenceNodeTest.TREE_WITH_INSERT); + final Node root = this.loadTree(DiffNodeTest.TREE_WITH_INSERT); Assertions.assertTrue(root instanceof DiffNode); final DiffNode diff = (DiffNode) root; final Node actual = diff.getBefore(); Assertions.assertNotEquals(EmptyTree.INSTANCE, actual); - final Node expected = this.loadTree(DifferenceNodeTest.TREE_AFTER_DELETE); + final Node expected = this.loadTree(DiffNodeTest.TREE_AFTER_DELETE); Assertions.assertTrue(expected.deepCompare(actual)); } @@ -96,12 +96,12 @@ void testInsertGetBefore() { */ @Test void testInsertGetAfter() { - final Node root = this.loadTree(DifferenceNodeTest.TREE_WITH_INSERT); + final Node root = this.loadTree(DiffNodeTest.TREE_WITH_INSERT); Assertions.assertTrue(root instanceof DiffNode); final DiffNode diff = (DiffNode) root; final Node actual = diff.getAfter(); Assertions.assertNotEquals(EmptyTree.INSTANCE, actual); - final Node expected = this.loadTree(DifferenceNodeTest.TREE_BEFO_DELETE); + final Node expected = this.loadTree(DiffNodeTest.TREE_BEFO_DELETE); Assertions.assertTrue(expected.deepCompare(actual)); } @@ -110,18 +110,18 @@ void testInsertGetAfter() { */ @Test void testReplace() { - final Node root = this.loadTree(DifferenceNodeTest.TREE_WITH_REPLACE); + final Node root = this.loadTree(DiffNodeTest.TREE_WITH_REPLACE); Assertions.assertTrue(root instanceof DiffNode); final DiffNode diff = (DiffNode) root; final Node before = diff.getBefore(); Assertions.assertNotEquals(EmptyTree.INSTANCE, before); Assertions.assertTrue( - before.deepCompare(this.loadTree(DifferenceNodeTest.TREE_BEFORE_REPL)) + before.deepCompare(this.loadTree(DiffNodeTest.TREE_BEFORE_REPL)) ); final Node after = diff.getAfter(); Assertions.assertNotEquals(EmptyTree.INSTANCE, after); Assertions.assertTrue( - after.deepCompare(this.loadTree(DifferenceNodeTest.TREE_AFTER_REPL)) + after.deepCompare(this.loadTree(DiffNodeTest.TREE_AFTER_REPL)) ); } @@ -130,12 +130,12 @@ void testReplace() { */ @Test void testDeleteGetBefore() { - final Node root = this.loadTree(DifferenceNodeTest.TREE_WITH_DELETE); + final Node root = this.loadTree(DiffNodeTest.TREE_WITH_DELETE); Assertions.assertTrue(root instanceof DiffNode); final DiffNode diff = (DiffNode) root; final Node actual = diff.getBefore(); Assertions.assertNotEquals(EmptyTree.INSTANCE, actual); - final Node expected = this.loadTree(DifferenceNodeTest.TREE_BEFO_DELETE); + final Node expected = this.loadTree(DiffNodeTest.TREE_BEFO_DELETE); Assertions.assertTrue(expected.deepCompare(actual)); } @@ -144,12 +144,12 @@ void testDeleteGetBefore() { */ @Test void testDeleteGetAfter() { - final Node root = this.loadTree(DifferenceNodeTest.TREE_WITH_DELETE); + final Node root = this.loadTree(DiffNodeTest.TREE_WITH_DELETE); Assertions.assertTrue(root instanceof DiffNode); final DiffNode diff = (DiffNode) root; final Node actual = diff.getAfter(); Assertions.assertNotEquals(EmptyTree.INSTANCE, actual); - final Node expected = this.loadTree(DifferenceNodeTest.TREE_AFTER_DELETE); + final Node expected = this.loadTree(DiffNodeTest.TREE_AFTER_DELETE); Assertions.assertTrue(expected.deepCompare(actual)); } @@ -218,7 +218,7 @@ void testDiffNodeAsString() { * @return The file content */ private String getFileContent(final String name) { - final String file = DifferenceNodeTest.TESTS_PATH.concat(name); + final String file = DiffNodeTest.TESTS_PATH.concat(name); boolean oops = false; String source = ""; try { diff --git a/src/test/java/org/cqfn/astranaut/core/base/PatternNodeTest.java b/src/test/java/org/cqfn/astranaut/core/base/PatternNodeTest.java index 0ca3868..c77e59a 100644 --- a/src/test/java/org/cqfn/astranaut/core/base/PatternNodeTest.java +++ b/src/test/java/org/cqfn/astranaut/core/base/PatternNodeTest.java @@ -61,9 +61,9 @@ public Position getEnd() { * Source implementation for test purposes. * @since 1.1.5 */ - private static class TestSource implements Source { + private static final class TestSource implements Source { @Override - public String getFragmentAsString(Position start, Position end) { + public String getFragmentAsString(final Position start, final Position end) { return ""; } } @@ -72,7 +72,7 @@ public String getFragmentAsString(Position start, Position end) { * Position implementation for test purposes. * @since 1.1.5 */ - private static class TestPosition implements Position { + private static final class TestPosition implements Position { /** * Source. */ @@ -88,7 +88,7 @@ private static class TestPosition implements Position { * @param source Source * @param column Column number */ - private TestPosition(final Source source, int column) { + private TestPosition(final Source source, final int column) { this.source = source; this.column = column; }