Cleaned up tests

This commit is contained in:
Erik C. Thauvin 2023-08-19 11:48:08 -07:00
parent 35eb6d4a77
commit 6451d45e7c
4 changed files with 23 additions and 24 deletions

View file

@ -36,7 +36,6 @@ import rife.bld.BuildCommand;
import rife.bld.Project; import rife.bld.Project;
import rife.bld.extension.JacocoReportOperation; import rife.bld.extension.JacocoReportOperation;
import rife.bld.extension.PmdOperation; import rife.bld.extension.PmdOperation;
import rife.bld.extension.TestNgOperation;
import rife.bld.publish.*; import rife.bld.publish.*;
import rife.tools.exceptions.FileUtilsErrorException; import rife.tools.exceptions.FileUtilsErrorException;
@ -45,7 +44,8 @@ import java.nio.file.Path;
import java.util.List; import java.util.List;
import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.*; import static rife.bld.dependencies.Scope.compile;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class SemverBuild extends Project { public class SemverBuild extends Project {
@ -66,7 +66,6 @@ public class SemverBuild extends Project {
.include(dependency("com.github.spullara.mustache.java", "compiler", .include(dependency("com.github.spullara.mustache.java", "compiler",
version(0, 9, 10))); version(0, 9, 10)));
scope(test) scope(test)
.include(dependency("org.assertj", "assertj-joda-time", version(2, 2, 0)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0))); .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)));
@ -122,11 +121,6 @@ public class SemverBuild extends Project {
.execute(); .execute();
} }
private void rootPom() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().info(), publishOperation().dependencies(),
Path.of(workDirectory.getPath(), "pom.xml").toFile());
}
@Override @Override
public void publish() throws Exception { public void publish() throws Exception {
super.publish(); super.publish();
@ -138,4 +132,9 @@ public class SemverBuild extends Project {
super.publishLocal(); super.publishLocal();
rootPom(); rootPom();
} }
private void rootPom() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().info(), publishOperation().dependencies(),
Path.of(workDirectory.getPath(), "pom.xml").toFile());
}
} }

View file

@ -38,8 +38,8 @@ import org.junit.jupiter.api.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals; // NOPMD
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue; // NOPMD
/** /**
* The <code>ConstantsTest</code> class. * The <code>ConstantsTest</code> class.
@ -48,9 +48,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* @created.on 2019-04-14 * @created.on 2019-04-14
* @since 1.0 * @since 1.0
*/ */
public class ConstantsTest { class ConstantsTest {
@Test @Test
public void testDefaults() { void testDefaults() {
assertEquals(1, Constants.DEFAULT_MAJOR, "major"); assertEquals(1, Constants.DEFAULT_MAJOR, "major");
assertEquals(0, Constants.DEFAULT_MINOR, "minor"); assertEquals(0, Constants.DEFAULT_MINOR, "minor");
assertEquals(0, Constants.DEFAULT_PATCH, "patch"); assertEquals(0, Constants.DEFAULT_PATCH, "patch");
@ -60,7 +60,7 @@ public class ConstantsTest {
} }
@Test @Test
public void testTemplates() { void testTemplates() {
final List<String> templates = new ArrayList<>(); final List<String> templates = new ArrayList<>();
templates.add(Constants.DEFAULT_JAVA_TEMPLATE); templates.add(Constants.DEFAULT_JAVA_TEMPLATE);
templates.add(Constants.DEFAULT_KOTLIN_TEMPLATE); templates.add(Constants.DEFAULT_KOTLIN_TEMPLATE);

View file

@ -34,10 +34,10 @@ package net.thauvin.erik.semver;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.Date; import java.util.Date; // NOPMD
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals; // NOPMD
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue; // NOPMD
/** /**
* The <code>VersionInfoTest</code> class. * The <code>VersionInfoTest</code> class.
@ -46,12 +46,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* @created.on 2016-02-03 * @created.on 2016-02-03
* @since 1.0 * @since 1.0
*/ */
public class VersionInfoTest { class VersionInfoTest {
private VersionInfo versionInfo = new VersionInfo(); private VersionInfo versionInfo = new VersionInfo();
@SuppressWarnings("PMD.AvoidUsingHardCodedIP") @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
@Test @Test
public void testGetVersion() { void testGetVersion() {
assertEquals("1.0.0", versionInfo.getVersion(), "getVersion(1.0.0)"); assertEquals("1.0.0", versionInfo.getVersion(), "getVersion(1.0.0)");
versionInfo.setMajor(3); versionInfo.setMajor(3);
@ -99,7 +99,7 @@ public class VersionInfoTest {
} }
@Test @Test
public void testSetGet() { void testSetGet() {
versionInfo.setSeparator("."); versionInfo.setSeparator(".");
versionInfo.setMajor(1); versionInfo.setMajor(1);
@ -160,7 +160,7 @@ public class VersionInfoTest {
} }
@Test @Test
public void testVersionInfo() { void testVersionInfo() {
final Version version = new VersionTest(); final Version version = new VersionTest();
versionInfo = new VersionInfo(version); versionInfo = new VersionInfo(version);

View file

@ -38,7 +38,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Properties; import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals; // NOPMD
/** /**
* The <code>VersionProcessorTest</code> class. * The <code>VersionProcessorTest</code> class.
@ -47,13 +47,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
* @created.on 2019-04-02 * @created.on 2019-04-02
* @since 1.2.0 * @since 1.2.0
*/ */
public class VersionProcessorTest { class VersionProcessorTest {
private final VersionProcessor processor = new VersionProcessor(); private final VersionProcessor processor = new VersionProcessor();
private final Version version = new VersionTest(); private final Version version = new VersionTest();
@SuppressWarnings("PMD.AvoidAccessibilityAlteration") @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test @Test
public void testFindValues() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { void testFindValues() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
final Method method = processor.getClass().getDeclaredMethod("findValues", Version.class); final Method method = processor.getClass().getDeclaredMethod("findValues", Version.class);
method.setAccessible(true); method.setAccessible(true);
final VersionInfo versionInfo = (VersionInfo) method.invoke(processor, version); final VersionInfo versionInfo = (VersionInfo) method.invoke(processor, version);
@ -64,7 +64,7 @@ public class VersionProcessorTest {
@SuppressWarnings("PMD.AvoidAccessibilityAlteration") @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test @Test
public void testParseIntProperty() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { void testParseIntProperty() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
final Properties p = new Properties(); final Properties p = new Properties();
p.setProperty("1", "1"); p.setProperty("1", "1");
p.setProperty("2", "2.1"); p.setProperty("2", "2.1");