From: gotty Date: Fri, 19 Apr 2019 03:12:18 +0000 (+0300) Subject: [LIB-9] Separate chesshog-format module X-Git-Url: https://git.hedgecode.org/?a=commitdiff_plain;h=3819e21945f32159d441ee441f2cd156fcd8389f;p=chesshog.git [LIB-9] Separate chesshog-format module --- diff --git a/chesshog-format/pom.xml b/chesshog-format/pom.xml new file mode 100644 index 0000000..86a1a3f --- /dev/null +++ b/chesshog-format/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + + + org.hedgecode.chess + chesshog + 0.1-SNAPSHOT + + + chesshog-format + 0.1-SNAPSHOT + jar + + Hedgecode ChessHog Format + + Hedgecode ChessHog Format Module. + + + + 0.1-SNAPSHOT + + + + + org.hedgecode.chess + chesshog + ${chessHogVersion} + + + org.hedgecode.chess + chesshog-core + ${chessHogVersion} + + + + \ No newline at end of file diff --git a/src/main/java/org/hedgecode/chess/Builders.java b/chesshog-format/src/main/java/org/hedgecode/chess/Builders.java similarity index 100% rename from src/main/java/org/hedgecode/chess/Builders.java rename to chesshog-format/src/main/java/org/hedgecode/chess/Builders.java diff --git a/src/main/java/org/hedgecode/chess/Parsers.java b/chesshog-format/src/main/java/org/hedgecode/chess/Parsers.java similarity index 100% rename from src/main/java/org/hedgecode/chess/Parsers.java rename to chesshog-format/src/main/java/org/hedgecode/chess/Parsers.java diff --git a/src/main/java/org/hedgecode/chess/ascii/ASCII.java b/chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCII.java similarity index 100% rename from src/main/java/org/hedgecode/chess/ascii/ASCII.java rename to chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCII.java diff --git a/src/main/java/org/hedgecode/chess/ascii/ASCIIBoardType.java b/chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCIIBoardType.java similarity index 100% rename from src/main/java/org/hedgecode/chess/ascii/ASCIIBoardType.java rename to chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCIIBoardType.java diff --git a/src/main/java/org/hedgecode/chess/ascii/ASCIIBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCIIBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/ascii/ASCIIBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCIIBuilder.java diff --git a/src/main/java/org/hedgecode/chess/ascii/ASCIIParser.java b/chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCIIParser.java similarity index 100% rename from src/main/java/org/hedgecode/chess/ascii/ASCIIParser.java rename to chesshog-format/src/main/java/org/hedgecode/chess/ascii/ASCIIParser.java diff --git a/src/main/java/org/hedgecode/chess/fen/FEN.java b/chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java similarity index 95% rename from src/main/java/org/hedgecode/chess/fen/FEN.java rename to chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java index 5145ae4..36a781c 100644 --- a/src/main/java/org/hedgecode/chess/fen/FEN.java +++ b/chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -140,11 +140,11 @@ public final class FEN { } else { boolean isKing = false, isQueen = false; switch (color) { - case WHITE: + case Color.WHITE: isKing = (castles.indexOf(WHITE_KING) >= 0); isQueen = (castles.indexOf(WHITE_QUEEN) >= 0); break; - case BLACK: + case Color.BLACK: isKing = (castles.indexOf(BLACK_KING) >= 0); isQueen = (castles.indexOf(BLACK_QUEEN) >= 0); break; @@ -160,24 +160,24 @@ public final class FEN { public static String getCastle(Castle whiteCastle, Castle blackCastle) { StringBuilder sb = new StringBuilder(); switch (whiteCastle) { - case KING: + case Castle.KING: sb.append(WHITE_KING); break; - case QUEEN: + case Castle.QUEEN: sb.append(WHITE_QUEEN); break; - case BOTH: + case Castle.BOTH: sb.append(WHITE_KING).append(WHITE_QUEEN); break; } switch (blackCastle) { - case KING: + case Castle.KING: sb.append(BLACK_KING); break; - case QUEEN: + case Castle.QUEEN: sb.append(BLACK_QUEEN); break; - case BOTH: + case Castle.BOTH: sb.append(BLACK_KING).append(BLACK_QUEEN); break; } diff --git a/src/main/java/org/hedgecode/chess/fen/FENBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/fen/FENBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/fen/FENBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/fen/FENBuilder.java diff --git a/src/main/java/org/hedgecode/chess/fen/FENParser.java b/chesshog-format/src/main/java/org/hedgecode/chess/fen/FENParser.java similarity index 100% rename from src/main/java/org/hedgecode/chess/fen/FENParser.java rename to chesshog-format/src/main/java/org/hedgecode/chess/fen/FENParser.java diff --git a/src/main/java/org/hedgecode/chess/img/AbstractImageLoader.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/AbstractImageLoader.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/AbstractImageLoader.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/AbstractImageLoader.java diff --git a/src/main/java/org/hedgecode/chess/img/DiagramBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/DiagramBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/DiagramBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/DiagramBuilder.java diff --git a/src/main/java/org/hedgecode/chess/img/ImageBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/ImageBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/ImageBuilder.java diff --git a/src/main/java/org/hedgecode/chess/img/ImageConstants.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageConstants.java similarity index 94% rename from src/main/java/org/hedgecode/chess/img/ImageConstants.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/ImageConstants.java index f4b4d44..eb85f1a 100644 --- a/src/main/java/org/hedgecode/chess/img/ImageConstants.java +++ b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageConstants.java @@ -34,7 +34,7 @@ public final class ImageConstants { private ImageConstants() { throw new AssertionError( - "No org.hedgecode.chess.img.ImageConstants instances!" + "No ImageConstants instances!" ); } diff --git a/src/main/java/org/hedgecode/chess/img/ImageException.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageException.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/ImageException.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/ImageException.java diff --git a/src/main/java/org/hedgecode/chess/img/ImageFilter.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageFilter.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/ImageFilter.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/ImageFilter.java diff --git a/src/main/java/org/hedgecode/chess/img/ImageFormat.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageFormat.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/ImageFormat.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/ImageFormat.java diff --git a/src/main/java/org/hedgecode/chess/img/ImageLoader.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/ImageLoader.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/ImageLoader.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/ImageLoader.java diff --git a/src/main/java/org/hedgecode/chess/img/board/Board.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/board/Board.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/board/Board.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/board/Board.java diff --git a/src/main/java/org/hedgecode/chess/img/board/BoardLoader.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/board/BoardLoader.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/board/BoardLoader.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/board/BoardLoader.java diff --git a/src/main/java/org/hedgecode/chess/img/board/SquarePair.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/board/SquarePair.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/board/SquarePair.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/board/SquarePair.java diff --git a/src/main/java/org/hedgecode/chess/img/piece/PieceSet.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/piece/PieceSet.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/piece/PieceSet.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/piece/PieceSet.java diff --git a/src/main/java/org/hedgecode/chess/img/piece/PieceSetLoader.java b/chesshog-format/src/main/java/org/hedgecode/chess/img/piece/PieceSetLoader.java similarity index 100% rename from src/main/java/org/hedgecode/chess/img/piece/PieceSetLoader.java rename to chesshog-format/src/main/java/org/hedgecode/chess/img/piece/PieceSetLoader.java diff --git a/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java diff --git a/src/main/java/org/hedgecode/chess/pgn/PGNParser.java b/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNParser.java similarity index 100% rename from src/main/java/org/hedgecode/chess/pgn/PGNParser.java rename to chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNParser.java diff --git a/src/main/java/org/hedgecode/chess/tcd/TCD.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCD.java similarity index 100% rename from src/main/java/org/hedgecode/chess/tcd/TCD.java rename to chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCD.java diff --git a/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java similarity index 96% rename from src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java index bc37d20..b72372c 100644 --- a/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java +++ b/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,22 +82,22 @@ public final class TCDBuilder implements Builder { byte[] pieces = new byte[2 * (squarePieces.size() + 1)]; int i = 0; switch (piece) { - case PAWN: + case Piece.PAWN: pieces[i++] = TCD.PAWN; break; - case KNIGHT: + case Piece.KNIGHT: pieces[i++] = TCD.KNIGHT; break; - case BISHOP: + case Piece.BISHOP: pieces[i++] = TCD.BISHOP; break; - case ROOK: + case Piece.ROOK: pieces[i++] = TCD.ROOK; break; - case QUEEN: + case Piece.QUEEN: pieces[i++] = TCD.QUEEN; break; - case KING: + case Piece.KING: pieces[i++] = TCD.KING; break; } @@ -143,13 +143,13 @@ public final class TCDBuilder implements Builder { if (castle != null) { byte castleByte; switch (castle) { - case KING: + case Castle.KING: castleByte = TCD.CASTLE_KING; break; - case QUEEN: + case Castle.QUEEN: castleByte = TCD.CASTLE_QUEEN; break; - case BOTH: + case Castle.BOTH: castleByte = TCD.CASTLE_BOTH; break; default: diff --git a/src/main/java/org/hedgecode/chess/tcd/TCDParser.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDParser.java similarity index 100% rename from src/main/java/org/hedgecode/chess/tcd/TCDParser.java rename to chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDParser.java diff --git a/src/main/java/org/hedgecode/chess/tcg/TCG.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcg/TCG.java similarity index 100% rename from src/main/java/org/hedgecode/chess/tcg/TCG.java rename to chesshog-format/src/main/java/org/hedgecode/chess/tcg/TCG.java diff --git a/src/main/java/org/hedgecode/chess/tcg/TCGBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcg/TCGBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/tcg/TCGBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/tcg/TCGBuilder.java diff --git a/src/main/java/org/hedgecode/chess/tcg/TCGParser.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcg/TCGParser.java similarity index 100% rename from src/main/java/org/hedgecode/chess/tcg/TCGParser.java rename to chesshog-format/src/main/java/org/hedgecode/chess/tcg/TCGParser.java diff --git a/src/main/java/org/hedgecode/chess/wiki/Wiki.java b/chesshog-format/src/main/java/org/hedgecode/chess/wiki/Wiki.java similarity index 100% rename from src/main/java/org/hedgecode/chess/wiki/Wiki.java rename to chesshog-format/src/main/java/org/hedgecode/chess/wiki/Wiki.java diff --git a/src/main/java/org/hedgecode/chess/wiki/WikiBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/wiki/WikiBuilder.java similarity index 100% rename from src/main/java/org/hedgecode/chess/wiki/WikiBuilder.java rename to chesshog-format/src/main/java/org/hedgecode/chess/wiki/WikiBuilder.java diff --git a/src/main/java/org/hedgecode/chess/wiki/WikiParser.java b/chesshog-format/src/main/java/org/hedgecode/chess/wiki/WikiParser.java similarity index 100% rename from src/main/java/org/hedgecode/chess/wiki/WikiParser.java rename to chesshog-format/src/main/java/org/hedgecode/chess/wiki/WikiParser.java diff --git a/src/main/resources/org/hedgecode/chess/LocalStrings.properties b/chesshog-format/src/main/resources/org/hedgecode/chess/LocalStrings.properties similarity index 100% rename from src/main/resources/org/hedgecode/chess/LocalStrings.properties rename to chesshog-format/src/main/resources/org/hedgecode/chess/LocalStrings.properties diff --git a/src/main/resources/org/hedgecode/chess/LocalStrings_ru.properties b/chesshog-format/src/main/resources/org/hedgecode/chess/LocalStrings_ru.properties similarity index 100% rename from src/main/resources/org/hedgecode/chess/LocalStrings_ru.properties rename to chesshog-format/src/main/resources/org/hedgecode/chess/LocalStrings_ru.properties diff --git a/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java similarity index 86% rename from src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java index 7c96f14..2c5e177 100644 --- a/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import java.util.List; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.commons.configuration.XMLConfiguration; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -43,15 +44,15 @@ public class ASCIIBuilderTest extends AbstractPositionTest implements ASCIIPosit @Test public void testBuild() throws Exception { Builder asciiBuilder = ASCIIBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_ASCII_POSITION, testConfig.getString(NAME) + MSG_ASCII_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String ascii = testConfig.getString(ASCII_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); if (testConfig.containsKey(ASCII_TYPE)) { ASCII.setType( @@ -74,11 +75,11 @@ public class ASCIIBuilderTest extends AbstractPositionTest implements ASCIIPosit @Override protected void assertStringEquals(String expected, String actual) { - assertNotNull(expected); - assertNotNull(actual); + Assert.assertNotNull(expected); + Assert.assertNotNull(actual); String[] expectedLines = expected.split(LINE_REGEX); String[] actualLines = actual.split(LINE_REGEX); - assertEquals( + Assert.assertEquals( expectedLines.length, actualLines.length ); @@ -93,10 +94,10 @@ public class ASCIIBuilderTest extends AbstractPositionTest implements ASCIIPosit @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java similarity index 86% rename from src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java index 87e2698..c8cce99 100644 --- a/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public class ASCIIParserTest extends AbstractPositionTest implements ASCIIPositi @Test public void testParse() throws Exception { Parser asciiParser = ASCIIParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_ASCII_POSITION, testConfig.getString(NAME) + MSG_ASCII_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String ascii = testConfig.getString(ASCII_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); assertDiagramEquals( position, @@ -61,10 +61,10 @@ public class ASCIIParserTest extends AbstractPositionTest implements ASCIIPositi @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/ascii/ASCIIPositionTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIPositionTest.java similarity index 100% rename from src/test/java/org/hedgecode/chess/ascii/ASCIIPositionTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIPositionTest.java diff --git a/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java similarity index 86% rename from src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java index 26e2ce8..b04b307 100644 --- a/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public class FENBuilderTest extends AbstractPositionTest implements FENPositionT @Test public void testBuild() throws Exception { Builder fenBuilder = FENBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_FEN_POSITION, testConfig.getString(NAME) + MSG_FEN_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String fen = testConfig.getString(FEN_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); assertStringEquals( fen, @@ -61,10 +61,10 @@ public class FENBuilderTest extends AbstractPositionTest implements FENPositionT @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/fen/FENParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java similarity index 86% rename from src/test/java/org/hedgecode/chess/fen/FENParserTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java index 4cb6f87..38d2520 100644 --- a/src/test/java/org/hedgecode/chess/fen/FENParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public class FENParserTest extends AbstractPositionTest implements FENPositionTe @Test public void testParse() throws Exception { Parser fenParser = FENParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_FEN_POSITION, testConfig.getString(NAME) + MSG_FEN_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String fen = testConfig.getString(FEN_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); assertPositionEquals( position, @@ -61,10 +61,10 @@ public class FENParserTest extends AbstractPositionTest implements FENPositionTe @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/fen/FENPositionTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENPositionTest.java similarity index 100% rename from src/test/java/org/hedgecode/chess/fen/FENPositionTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/fen/FENPositionTest.java diff --git a/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java similarity index 86% rename from src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java index 0818e31..9530475 100644 --- a/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public class TCDBuilderTest extends AbstractPositionTest implements TCDPositionT @Test public void testBuild() throws Exception { Builder tcdBuilder = TCDBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_TCD_POSITION, testConfig.getString(NAME) + MSG_TCD_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String tcd = testConfig.getString(TCD_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); assertStringEquals( tcd, @@ -61,10 +61,10 @@ public class TCDBuilderTest extends AbstractPositionTest implements TCDPositionT @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java similarity index 86% rename from src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java index 6472765..93ea766 100644 --- a/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public class TCDParserTest extends AbstractPositionTest implements TCDPositionTe @Test public void testParse() throws Exception { Parser tcdParser = TCDParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_TCD_POSITION, testConfig.getString(NAME) + MSG_TCD_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String tcd = testConfig.getString(TCD_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); assertPositionEquals( position, @@ -61,10 +61,10 @@ public class TCDParserTest extends AbstractPositionTest implements TCDPositionTe @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/tcd/TCDPositionTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDPositionTest.java similarity index 100% rename from src/test/java/org/hedgecode/chess/tcd/TCDPositionTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDPositionTest.java diff --git a/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java similarity index 85% rename from src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java index cbb2f2c..3db948a 100644 --- a/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import java.util.List; import org.apache.commons.configuration.HierarchicalConfiguration; import org.apache.commons.configuration.XMLConfiguration; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -43,15 +44,15 @@ public class WikiBuilderTest extends AbstractPositionTest implements WikiPositio @Test public void testBuild() throws Exception { Builder wikiBuilder = WikiBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_WIKI_POSITION, testConfig.getString(NAME) + MSG_WIKI_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String wiki = testConfig.getString(WIKI_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); boolean withTemplate = false; if (testConfig.containsKey(WIKI_TEMPLATE)) { @@ -67,11 +68,11 @@ public class WikiBuilderTest extends AbstractPositionTest implements WikiPositio @Override protected void assertStringEquals(String expected, String actual) { - assertNotNull(expected); - assertNotNull(actual); + Assert.assertNotNull(expected); + Assert.assertNotNull(actual); String[] expectedLines = expected.split(LINE_REGEX); String[] actualLines = actual.split(LINE_REGEX); - assertEquals( + Assert.assertEquals( expectedLines.length, actualLines.length ); @@ -86,10 +87,10 @@ public class WikiBuilderTest extends AbstractPositionTest implements WikiPositio @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java similarity index 87% rename from src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java index eb397ee..2a1ee8d 100644 --- a/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,15 +41,15 @@ public class WikiParserTest extends AbstractPositionTest implements WikiPosition @Test public void testParse() throws Exception { Parser wikiParser = WikiParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { setPositionName( String.format( - MSG_WIKI_POSITION, testConfig.getString(NAME) + MSG_WIKI_POSITION, testConfig.getString(AbstractPositionTest.NAME) ) ); String wiki = testConfig.getString(WIKI_TAG); Position position = assignPosition( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ); boolean withTemplate = false; if (testConfig.containsKey(WIKI_TEMPLATE)) { @@ -66,10 +66,10 @@ public class WikiParserTest extends AbstractPositionTest implements WikiPosition @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { xmlPositions.add( new XMLConfiguration( - testConfig.configurationAt(POSITION) + testConfig.configurationAt(AbstractPositionTest.POSITION) ) ); } diff --git a/src/test/java/org/hedgecode/chess/wiki/WikiPositionTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiPositionTest.java similarity index 100% rename from src/test/java/org/hedgecode/chess/wiki/WikiPositionTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiPositionTest.java diff --git a/src/test/resources/org/hedgecode/chess/ascii/ASCIIBuilderTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/ascii/ASCIIBuilderTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/ascii/ASCIIBuilderTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/ascii/ASCIIBuilderTest.xml diff --git a/src/test/resources/org/hedgecode/chess/ascii/ASCIIParserTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/ascii/ASCIIParserTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/ascii/ASCIIParserTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/ascii/ASCIIParserTest.xml diff --git a/src/test/resources/org/hedgecode/chess/fen/FENBuilderTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/fen/FENBuilderTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/fen/FENBuilderTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/fen/FENBuilderTest.xml diff --git a/src/test/resources/org/hedgecode/chess/fen/FENParserTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/fen/FENParserTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/fen/FENParserTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/fen/FENParserTest.xml diff --git a/src/test/resources/org/hedgecode/chess/tcd/TCDBuilderTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/tcd/TCDBuilderTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/tcd/TCDBuilderTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/tcd/TCDBuilderTest.xml diff --git a/src/test/resources/org/hedgecode/chess/tcd/TCDParserTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/tcd/TCDParserTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/tcd/TCDParserTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/tcd/TCDParserTest.xml diff --git a/src/test/resources/org/hedgecode/chess/wiki/WikiBuilderTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/wiki/WikiBuilderTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/wiki/WikiBuilderTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/wiki/WikiBuilderTest.xml diff --git a/src/test/resources/org/hedgecode/chess/wiki/WikiParserTest.xml b/chesshog-format/src/test/resources/org/hedgecode/chess/wiki/WikiParserTest.xml similarity index 100% rename from src/test/resources/org/hedgecode/chess/wiki/WikiParserTest.xml rename to chesshog-format/src/test/resources/org/hedgecode/chess/wiki/WikiParserTest.xml