Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to JUnit 5 (and fix building) #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>noise-java</artifactId>
<groupId>com.southerstorm</groupId>
<version>1.0-SNAPSHOT</version>
<project
xmlns="http://maven.apache.org/POM/4.0.0">

<modelVersion>4.0.0</modelVersion>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>noise-java</artifactId>
<groupId>com.southerstorm</groupId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,19 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.protocol.CipherState;
import com.southernstorm.noise.protocol.Noise;

import java.security.NoSuchAlgorithmException;
import java.util.Arrays;

import javax.crypto.BadPaddingException;
import javax.crypto.ShortBufferException;

import org.junit.Test;

import com.southernstorm.noise.protocol.CipherState;
import com.southernstorm.noise.protocol.Noise;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

/**
* Perform tests on the cipher algorithms used by Noise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.crypto.Curve25519;

import java.util.Arrays;

import org.junit.Test;

import com.southernstorm.noise.crypto.Curve25519;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import org.junit.jupiter.api.Test;

public class Curve25519Tests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.crypto.Curve448;

import java.util.Arrays;

import org.junit.Test;

import com.southernstorm.noise.crypto.Curve448;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

public class Curve448Tests {

Expand Down
8 changes: 3 additions & 5 deletions src/test/java/com/southernstorm/noise/tests/GHASHTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.crypto.GHASH;

import java.util.Arrays;

import org.junit.Test;

import com.southernstorm.noise.crypto.GHASH;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

public class GHASHTests {

Expand Down
8 changes: 3 additions & 5 deletions src/test/java/com/southernstorm/noise/tests/HashTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.protocol.Noise;

import java.security.DigestException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.junit.Test;

import com.southernstorm.noise.protocol.Noise;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

/**
* Perform tests on the hash algorithms used by Noise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.crypto.Poly1305;

import java.util.Arrays;

import org.junit.Test;

import com.southernstorm.noise.crypto.Poly1305;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import org.junit.jupiter.api.Test;

/**
* Perform tests on the Poly1305 implementation in isolation from ChaChaPoly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.noise.crypto.RijndaelAES;

import java.util.Arrays;

import org.junit.Test;

import com.southernstorm.noise.crypto.RijndaelAES;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

/**
* AES test cases to verify the fallback RijndaelAES implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import java.io.InputStream;
import java.net.URL;
import org.junit.Assert;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

public class UnitVectorTests {
Expand All @@ -16,7 +17,7 @@ void testBasicVector() throws Exception {
+ "/tests/vector/noise-c-basic.txt").openStream()) {
VectorTests vectorTests = new VectorTests();
vectorTests.processInputStream(stream);
Assert.assertEquals(vectorTests.getFailed(), 0);
assertEquals(vectorTests.getFailed(), 0);
}
}
}
13 changes: 6 additions & 7 deletions src/test/java/com/southernstorm/noise/tests/VectorTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package com.southernstorm.noise.tests;

import static org.junit.Assert.*;
import com.southernstorm.json.JsonReader;
import com.southernstorm.noise.protocol.CipherState;
import com.southernstorm.noise.protocol.CipherStatePair;
import com.southernstorm.noise.protocol.HandshakeState;

import java.io.BufferedReader;
import java.io.FileInputStream;
Expand All @@ -37,10 +39,7 @@
import javax.crypto.ShortBufferException;
import javax.xml.bind.DatatypeConverter;

import com.southernstorm.json.JsonReader;
import com.southernstorm.noise.protocol.CipherState;
import com.southernstorm.noise.protocol.CipherStatePair;
import com.southernstorm.noise.protocol.HandshakeState;
import static org.junit.jupiter.api.Assertions.*;

/**
* Executes Noise vector tests in JSON format.
Expand Down Expand Up @@ -116,7 +115,7 @@ public void addMessage(TestMessage msg)
private void assertSubArrayEquals(String msg, byte[] expected, byte[] actual)
{
for (int index = 0; index < expected.length; ++index)
assertEquals(msg + "[" + Integer.toString(index) + "]", expected[index], actual[index]);
assertEquals(expected[index], actual[index],msg + "[" + index + "]");
}

/**
Expand Down