summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Hopkins <masterofnumbers17@gmail.com>2019-10-15 17:53:40 -0400
committerAdrien Hopkins <masterofnumbers17@gmail.com>2019-10-15 17:53:40 -0400
commitefb8729719257c4a766058c5c7122648d94dd8b3 (patch)
tree2572db85f792ae49cd680b965dbe31b29e2f74b3
parent6392274ccc360c241cf31b10f1489cd6fc416eb8 (diff)
Upgraded to JUnit 5 and moved tests to their proper directories
-rw-r--r--.classpath6
-rw-r--r--.project6
-rw-r--r--src/org/unitConverter/UnitsDatabaseTest.java (renamed from src/test/java/UnitsDatabaseTest.java)15
-rw-r--r--src/org/unitConverter/dimension/UnitDimensionTest.java (renamed from src/test/java/UnitDimensionTest.java)12
-rw-r--r--src/org/unitConverter/math/ExpressionParserTest.java (renamed from src/test/java/ExpressionParserTest.java)9
-rw-r--r--src/org/unitConverter/unit/UnitTest.java (renamed from src/test/java/UnitTest.java)13
-rw-r--r--src/test/java/package-info.java24
7 files changed, 21 insertions, 64 deletions
diff --git a/.classpath b/.classpath
index ef141e6..8fc330a 100644
--- a/.classpath
+++ b/.classpath
@@ -5,16 +5,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/.project b/.project
index 56f686e..656186b 100644
--- a/.project
+++ b/.project
@@ -10,14 +10,8 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
diff --git a/src/test/java/UnitsDatabaseTest.java b/src/org/unitConverter/UnitsDatabaseTest.java
index 0d67c20..c46d598 100644
--- a/src/test/java/UnitsDatabaseTest.java
+++ b/src/org/unitConverter/UnitsDatabaseTest.java
@@ -14,19 +14,18 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package test.java;
+package org.unitConverter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-import org.junit.Test;
-import org.unitConverter.UnitsDatabase;
+import org.junit.jupiter.api.Test;
import org.unitConverter.unit.DefaultUnitPrefix;
import org.unitConverter.unit.LinearUnit;
import org.unitConverter.unit.SI;
@@ -40,7 +39,7 @@ import org.unitConverter.unit.UnitPrefix;
* @since 2019-04-14
* @since v0.2.0
*/
-public class UnitsDatabaseTest {
+class UnitsDatabaseTest {
// some linear units and one nonlinear
private static final Unit U = SI.METRE;
private static final Unit V = SI.KILOGRAM;
diff --git a/src/test/java/UnitDimensionTest.java b/src/org/unitConverter/dimension/UnitDimensionTest.java
index 587cf4c..017e3d2 100644
--- a/src/test/java/UnitDimensionTest.java
+++ b/src/org/unitConverter/dimension/UnitDimensionTest.java
@@ -14,10 +14,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package test.java;
+package org.unitConverter.dimension;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.unitConverter.dimension.StandardDimensions.AREA;
import static org.unitConverter.dimension.StandardDimensions.ENERGY;
import static org.unitConverter.dimension.StandardDimensions.LENGTH;
@@ -27,9 +27,7 @@ import static org.unitConverter.dimension.StandardDimensions.QUANTITY;
import static org.unitConverter.dimension.StandardDimensions.TIME;
import static org.unitConverter.dimension.StandardDimensions.VOLUME;
-import org.junit.Test;
-import org.unitConverter.dimension.SIBaseDimension;
-import org.unitConverter.dimension.UnitDimension;
+import org.junit.jupiter.api.Test;
/**
* Tests for {@link UnitDimension}. This is NOT part of this program's public API.
@@ -38,7 +36,7 @@ import org.unitConverter.dimension.UnitDimension;
* @since 2018-12-12
* @since v0.1.0
*/
-public class UnitDimensionTest {
+class UnitDimensionTest {
/**
* Tests {@link UnitDimension#equals}
*
diff --git a/src/test/java/ExpressionParserTest.java b/src/org/unitConverter/math/ExpressionParserTest.java
index 40c91ac..f3180c1 100644
--- a/src/test/java/ExpressionParserTest.java
+++ b/src/org/unitConverter/math/ExpressionParserTest.java
@@ -14,12 +14,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package test.java;
+package org.unitConverter.math;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
-import org.unitConverter.math.ExpressionParser;
+import org.junit.jupiter.api.Test;
/**
* A test for the {@code ExpressionParser} class. This is NOT part of this program's public API.
@@ -28,7 +27,7 @@ import org.unitConverter.math.ExpressionParser;
* @since 2019-03-22
* @since v0.2.0
*/
-public class ExpressionParserTest {
+class ExpressionParserTest {
private static final ExpressionParser<Integer> numberParser = new ExpressionParser.Builder<>(Integer::parseInt)
.addBinaryOperator("+", (o1, o2) -> o1 + o2, 0).addBinaryOperator("-", (o1, o2) -> o1 - o2, 0)
.addBinaryOperator("*", (o1, o2) -> o1 * o2, 1).addBinaryOperator("/", (o1, o2) -> o1 / o2, 1)
diff --git a/src/test/java/UnitTest.java b/src/org/unitConverter/unit/UnitTest.java
index 7a3f29d..7ae5fbf 100644
--- a/src/test/java/UnitTest.java
+++ b/src/org/unitConverter/unit/UnitTest.java
@@ -14,21 +14,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-package test.java;
+package org.unitConverter.unit;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.unitConverter.dimension.StandardDimensions;
import org.unitConverter.math.DecimalComparison;
-import org.unitConverter.unit.BaseUnit;
-import org.unitConverter.unit.LinearUnit;
-import org.unitConverter.unit.SI;
-import org.unitConverter.unit.SIPrefix;
-import org.unitConverter.unit.Unit;
/**
* Testing the various Unit classes. This is NOT part of this program's public API.
@@ -37,7 +32,7 @@ import org.unitConverter.unit.Unit;
* @since 2018-12-22
* @since v0.1.0
*/
-public class UnitTest {
+class UnitTest {
/** A random number generator */
private static final Random rng = ThreadLocalRandom.current();
diff --git a/src/test/java/package-info.java b/src/test/java/package-info.java
deleted file mode 100644
index 3da7fcb..0000000
--- a/src/test/java/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (C) 2019 Adrien Hopkins
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-/**
- * All of the Unit Converter tests. Everything in this package is NOT part of Unit Converter's public API.
- *
- * @author Adrien Hopkins
- * @since 2019-03-16
- * @since v0.2.0
- */
-package test.java; \ No newline at end of file