From 97b5282c5cbef9b06119b9012a6a255cd847292a Mon Sep 17 00:00:00 2001 From: Steve Wagner Date: Mon, 7 Dec 2015 07:24:00 -0800 Subject: [PATCH] Moving stuff around --- .../SemanticVersioning/AppVersionTests.java | 111 ------------------ .../SemanticVersioning/BowerParserTests.java | 76 ------------ .../BuildScalaParserTests.java | 76 ------------ .../MavenReleaseNamingStrategyTest.java | 89 -------------- .../SemanticVersioning/ParserTests.java | 56 --------- .../SemanticVersioning/PomParserTests.java | 78 ------------ .../SemanticVersioning/SbtParserTests.java | 66 ----------- 7 files changed, 552 deletions(-) delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/AppVersionTests.java delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/BowerParserTests.java delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/BuildScalaParserTests.java delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/MavenReleaseNamingStrategyTest.java delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/ParserTests.java delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/PomParserTests.java delete mode 100644 src/test/org/jenkinsci/plugins/SemanticVersioning/SbtParserTests.java diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/AppVersionTests.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/AppVersionTests.java deleted file mode 100644 index 084e811..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/AppVersionTests.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Steve Wagner - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.jenkinsci.plugins.SemanticVersioning.AppVersion; -import org.junit.Test; -import org.jvnet.hudson.test.WithoutJenkins; - -import static org.junit.Assert.*; - -public class AppVersionTests { - - @Test - @WithoutJenkins - public void testNonSnapshotVersionWithNoBuildNumber() { - System.out.println("####> testNonSnapshotVersionWithNoBuildNumber"); - final String versionString = "1.2"; - AppVersion version = AppVersion.parse(versionString); - - assertEquals(1, version.getMajor()); - assertEquals(2, version.getMinor()); - assertEquals(-1, version.getBuild()); - assertFalse(version.isSnapshot()); - assertEquals(versionString, version.toString()); - assertEquals(versionString, version.getOriginal()); - } - - @Test - @WithoutJenkins - public void testNonSnapshotVersionWithModifiedBuildNumber() { - System.out.println("####> testNonSnapshotVersionWithModifiedBuildNumber"); - final String versionString = "1.2"; - final int BUILD = 47; - AppVersion version = AppVersion.parse(versionString); - version.setBuild(BUILD); - - assertEquals(1, version.getMajor()); - assertEquals(2, version.getMinor()); - assertEquals(47, version.getBuild()); - assertFalse(version.isSnapshot()); - assertEquals(versionString + "." + BUILD, version.toString()); - assertEquals(versionString, version.getOriginal()); - } - - @Test - @WithoutJenkins - public void testSnapshotVersionWithNoBuildNumber() { - System.out.println("####> testSnapshotVersionWithNoBuildNumber"); - final String versionString = "1.2-SNAPSHOT"; - AppVersion version = AppVersion.parse(versionString); - - assertEquals(1, version.getMajor()); - assertEquals(2, version.getMinor()); - assertEquals(-1, version.getBuild()); - assertTrue(version.isSnapshot()); - assertEquals(versionString, version.toString()); - assertEquals(versionString, version.getOriginal()); - } - - @Test - @WithoutJenkins - public void testNonSnapshotVersionWithBuildNumber() { - System.out.println("####> testNonSnapshotVersionWithBuildNumber"); - final String versionString = "1.2.3"; - AppVersion version = AppVersion.parse(versionString); - - assertEquals(1, version.getMajor()); - assertEquals(2, version.getMinor()); - assertEquals(3, version.getBuild()); - assertFalse(version.isSnapshot()); - assertEquals(versionString, version.toString()); - assertEquals(versionString, version.getOriginal()); - } - - @Test - @WithoutJenkins - public void testSnapshotVersionWithBuildNumber() { - System.out.println("####> testSnapshotVersionWithBuildNumber"); - final String versionString = "1.2.3-SNAPSHOT"; - AppVersion version = AppVersion.parse(versionString); - - assertEquals(1, version.getMajor()); - assertEquals(2, version.getMinor()); - assertEquals(3, version.getBuild()); - assertTrue(version.isSnapshot()); - assertEquals(versionString, version.toString()); - assertEquals(versionString, version.getOriginal()); - } -} diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/BowerParserTests.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/BowerParserTests.java deleted file mode 100644 index 11ada2e..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/BowerParserTests.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Arne M. Størksen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildDefinitionParser; -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildScalaParser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; - -public class BowerParserTests extends ParserTests { - - @Override - protected BuildDefinitionParser getParser(String filename) { - return new BuildScalaParser(); - } - - @Override - protected void generateInvalidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("This is an invalid build file."); - - writeLinesToFile(filename, lines); - } - - @Override - protected void generateValidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("object ApplicationBuild extends Build {\n"); - lines.add("val neo4jVersion = \"1.9.2\"\n"); - lines.add("val appName = \"atomicsteampunk\"\n"); - lines.add("val appVersion = \"" + version + "\""); - lines.add("}\n"); - - writeLinesToFile(filename, lines); - } - - @Override - protected void generateBuildFileWithMissingVersion(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("object ApplicationBuild extends Build {\n"); - lines.add("val neo4jVersion = \"1.9.2\"\n"); - lines.add("val appName = \"atomicsteampunk\"\n"); - lines.add("}\n"); - - writeLinesToFile(filename, lines); - } - - @Override - protected String getExpectedInvalidBuildFileFormatExceptionMessage(String filename) { - return "'" + filename + "' is not a valid build definition file."; - } -} diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/BuildScalaParserTests.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/BuildScalaParserTests.java deleted file mode 100644 index 329361b..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/BuildScalaParserTests.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Steve Wagner - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildDefinitionParser; -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildScalaParser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; - -public class BuildScalaParserTests extends ParserTests { - - @Override - protected BuildDefinitionParser getParser(String filename) { - return new BuildScalaParser(); - } - - @Override - protected void generateInvalidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("This is an invalid build file."); - - writeLinesToFile(filename, lines); - } - - @Override - protected void generateValidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("object ApplicationBuild extends Build {\n"); - lines.add("val neo4jVersion = \"1.9.2\"\n"); - lines.add("val appName = \"atomicsteampunk\"\n"); - lines.add("val appVersion = \"" + version + "\""); - lines.add("}\n"); - - writeLinesToFile(filename, lines); - } - - @Override - protected void generateBuildFileWithMissingVersion(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("object ApplicationBuild extends Build {\n"); - lines.add("val neo4jVersion = \"1.9.2\"\n"); - lines.add("val appName = \"atomicsteampunk\"\n"); - lines.add("}\n"); - - writeLinesToFile(filename, lines); - } - - @Override - protected String getExpectedInvalidBuildFileFormatExceptionMessage(String filename) { - return "'" + filename + "' is not a valid build definition file."; - } -} diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/MavenReleaseNamingStrategyTest.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/MavenReleaseNamingStrategyTest.java deleted file mode 100644 index 3d33dd5..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/MavenReleaseNamingStrategyTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Steve Wagner - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.jenkinsci.plugins.SemanticVersioning.AppVersion; -import org.jenkinsci.plugins.SemanticVersioning.Messages; -import org.jenkinsci.plugins.SemanticVersioning.naming.MavenReleaseNamingStrategy; -import org.jenkinsci.plugins.SemanticVersioning.naming.NamingStrategy; -import org.junit.Test; -import org.jvnet.hudson.test.WithoutJenkins; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.*; - -public class MavenReleaseNamingStrategyTest { - - NamingStrategy strategy = new MavenReleaseNamingStrategy(); - - @Test - @WithoutJenkins - public void displayNameIsCorrect() { - assertEquals(Messages.NamingStrategies.MAVEN_RELEASE_DEVELOPMENT, strategy.getDescriptor().getDisplayName()); - } - - @Test - @WithoutJenkins - public void exportNamesWithNoBuildNumber() { - Map vars = new HashMap(); - AppVersion version = AppVersion.parse("1.2"); - assertFalse(version.isSnapshot()); - String versionString = strategy.exportNames(version, vars, false, 0); - assertEquals("1.2", versionString); - } - - @Test - @WithoutJenkins - public void exportNamesWithBuildNumber() { - Map vars = new HashMap(); - AppVersion version = AppVersion.parse("1.2"); - assertFalse(version.isSnapshot()); - String versionString = strategy.exportNames(version, vars, true, 487); - assertEquals("1.2.487", versionString); - } - - @Test - @WithoutJenkins - public void exportNamesWithNoBuildNumberIsSnapshot() { - Map vars = new HashMap(); - AppVersion version = AppVersion.parse("1.2-SNAPSHOT"); - assertTrue(version.isSnapshot()); - String versionString = strategy.exportNames(version, vars, false, 0); - assertEquals("1.2", versionString); - assertEquals(vars.get("developmentVersion"), "1.3-SNAPSHOT"); - } - - @Test - @WithoutJenkins - public void exportNamesWithBuildNumberIsSnapshot() { - Map vars = new HashMap(); - AppVersion version = AppVersion.parse("1.2-SNAPSHOT"); - assertTrue(version.isSnapshot()); - String versionString = strategy.exportNames(version, vars, true, 487); - assertEquals("1.2.487", versionString); - } -} diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/ParserTests.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/ParserTests.java deleted file mode 100644 index 8997fcf..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/ParserTests.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Steve Wagner - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.apache.commons.io.FileUtils; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildDefinitionParser; - -import java.io.File; -import java.io.IOException; -import java.util.Collection; - -public abstract class ParserTests { - - protected final String version = "1.2.3-SNAPSHOT"; - protected final Logger logger = LogManager.getLogger(ParserTests.class); - - protected abstract BuildDefinitionParser getParser(String filename); - protected abstract void generateInvalidBuildFile(String filename) throws IOException; - protected abstract void generateValidBuildFile(String filename) throws IOException; - protected abstract void generateBuildFileWithMissingVersion(String filename) throws IOException; - protected abstract String getExpectedInvalidBuildFileFormatExceptionMessage(String filename); - - protected void writeLinesToFile(String filename, Collection lines) throws IOException { - File file = new File(filename); - if (file.exists()) { - file.delete(); - } - file.setWritable(true); - - FileUtils.writeLines(file, lines); - } -} diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/PomParserTests.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/PomParserTests.java deleted file mode 100644 index a2cda0f..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/PomParserTests.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Steve Wagner - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildDefinitionParser; -import org.jenkinsci.plugins.SemanticVersioning.parsing.PomParser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; - -public class PomParserTests extends ParserTests { - - @Override - protected BuildDefinitionParser getParser(String filename) { - return new PomParser(); - } - - @Override - protected void generateInvalidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add(""); - - writeLinesToFile(filename, lines); - } - - @Override - protected void generateValidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add(""); - lines.add("org.jenkins-ci.plugins"); - lines.add("SemanticVersioning"); - lines.add("" + version + ""); - lines.add("hpi"); - lines.add(""); - - writeLinesToFile(filename, lines); - } - - @Override - protected void generateBuildFileWithMissingVersion(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add(""); - lines.add("org.jenkins-ci.plugins"); - lines.add("SemanticVersioning"); - lines.add("hpi"); - lines.add(""); - - writeLinesToFile(filename, lines); - } - - @Override - protected String getExpectedInvalidBuildFileFormatExceptionMessage(String filename) { - return filename + " is not a valid POM file."; - } -} diff --git a/src/test/org/jenkinsci/plugins/SemanticVersioning/SbtParserTests.java b/src/test/org/jenkinsci/plugins/SemanticVersioning/SbtParserTests.java deleted file mode 100644 index 6fccaec..0000000 --- a/src/test/org/jenkinsci/plugins/SemanticVersioning/SbtParserTests.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License - * - * Copyright (c) 2014, Steve Wagner - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.jenkinsci.plugins.SemanticVersioning; - -import org.jenkinsci.plugins.SemanticVersioning.parsing.BuildDefinitionParser; -import org.jenkinsci.plugins.SemanticVersioning.parsing.SbtParser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; - -public class SbtParserTests extends ParserTests { - - @Override - protected BuildDefinitionParser getParser(String filename) { - return new SbtParser(); - } - - @Override - protected void generateInvalidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - writeLinesToFile(filename, lines); - } - - @Override - protected void generateValidBuildFile(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("name := \"TestApp\""); - lines.add("version := \"" + version + "\""); - writeLinesToFile(filename, lines); - } - - @Override - protected void generateBuildFileWithMissingVersion(String filename) throws IOException { - Collection lines = new ArrayList(); - lines.add("name := \"TestApp\""); - writeLinesToFile(filename, lines); - } - - @Override - protected String getExpectedInvalidBuildFileFormatExceptionMessage(String filename) { - return "'" + filename + "' is not a valid SBT build definition file."; - } -}