Skip to content

Commit

Permalink
migrate from testng to new junit-jupiter
Browse files Browse the repository at this point in the history
- remove of test dependency testng
- added new test dependency org.junit.jupiter:junit-jupiter in version 5.11.0-M2
  • Loading branch information
astrapisixtynine committed Jul 9, 2024
1 parent 85fd6e6 commit 3d3e44d
Show file tree
Hide file tree
Showing 51 changed files with 232 additions and 210 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ Version 9.1-SNAPSHOT
ADDED:

- new libs.versions.toml file for new automatic catalog versions update

- new test dependency org.junit.jupiter:junit-jupiter in version 5.11.0-M2

CHANGED:

- remove of test dependency testng
- update gradle to new version 8.8
- update of gradle-plugin dependency 'com.diffplug.spotless:spotless-plugin-gradle' to new minor version 7.0.0.BETA1
- update of dependency commons-codec dependency version to 1.17.0
Expand All @@ -22,7 +23,8 @@ CHANGED:
- update of dependency silly-strings to new minor version 9.1
- update of dependency throwable to new major version 3
- update of test dependency silly-io to new version 3.1
- update of test dependency testng to new version to 7.10.2
- remove of test dependency testng
- migrate from testng to new junit-jupiter

Version 9
-------------
Expand Down
1 change: 1 addition & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ dependencies {
testImplementation libs.random.beans
// Note: use of bundles...
testImplementation libs.bundles.unit.testing
testRuntimeOnly libs.junit.platform.launcher

}
11 changes: 8 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ silly-collection-version = "27.1"
silly-io-version = "3.1"
silly-strings-version = "9.1"
test-object-version = "8.2"
testng-version = "7.10.2"
throwable-version = "3"
xml-base-version = "2"
junit-jupiter-params-version = "5.11.0-M2"
junit-jupiter-version = "5.11.0-M2"
junit-platform-launcher-version = "1.11.0-M2"

[libraries]
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter-version" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-jupiter-params-version" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform-launcher-version" }
bcpkix-jdk15on = { module = "org.bouncycastle:bcpkix-jdk15on", version.ref = "bcpkix-jdk15on-version" }
bcprov-ext-jdk15on = { module = "org.bouncycastle:bcprov-ext-jdk15on", version.ref = "bcprov-ext-jdk15on-version" }
bcprov-jdk15on = { module = "org.bouncycastle:bcprov-jdk15on", version.ref = "bcprov-jdk15on-version" }
Expand All @@ -53,15 +58,15 @@ silly-collection = { module = "io.github.astrapi69:silly-collection", version.re
silly-io = { module = "io.github.astrapi69:silly-io", version.ref = "silly-io-version" }
silly-strings = { module = "io.github.astrapi69:silly-strings", version.ref = "silly-strings-version" }
test-object = { module = "io.github.astrapi69:test-object", version.ref = "test-object-version" }
testng = { module = "org.testng:testng", version.ref = "testng-version" }
throwable = { module = "io.github.astrapi69:throwable", version.ref = "throwable-version" }
xml-base = { module = "io.github.astrapi69:xml-base", version.ref = "xml-base-version" }

[bundles]
unit-testing = [
"meanbean",
"test-object",
"testng",
"junit-jupiter",
"junit-jupiter-params",
]

[plugins]
Expand Down
2 changes: 1 addition & 1 deletion gradle/testing.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test {
useTestNG()
useJUnitPlatform()
}

jacocoTestReport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
*/
package io.github.astrapi69.mystic.crypt.base;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.nio.charset.StandardCharsets;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.crypt.api.algorithm.AesAlgorithm;
import io.github.astrapi69.crypt.data.factory.SecretKeyFactoryExtensions;
Expand All @@ -51,7 +51,7 @@ public class BaseByteArrayEnDecryptorTest
* @throws Exception
* is thrown if a security error occurs
*/
@BeforeMethod
@BeforeEach
protected void setUp() throws Exception
{
secretKey = SecretKeyFactoryExtensions.newSecretKey(AesAlgorithm.AES.name(), 128);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/
package io.github.astrapi69.mystic.crypt.chainable;

import static org.testng.AssertJUnit.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.mystic.crypt.hex.HexableDecryptor;
import io.github.astrapi69.mystic.crypt.hex.HexableEncryptor;
Expand Down Expand Up @@ -79,8 +79,8 @@ public void testChainedEncryptDecrypt() throws Exception
decryptor = new ChainableStringDecryptor(thirdDecryptor, secondDecryptor, firstDecryptor);

decryted = decryptor.decrypt(encrypted);
assertTrue("String before encryption is not equal after decryption.",
secretMessage.equals(decryted));
assertTrue(secretMessage.equals(decryted),
"String before encryption is not equal after decryption.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
*/
package io.github.astrapi69.mystic.crypt.decorator;

import static org.testng.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.nio.charset.Charset;

import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.crypt.data.model.CryptObjectDecorator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@
*/
package io.github.astrapi69.mystic.crypt.file;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.io.FileNotFoundException;

import javax.crypto.Cipher;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.checksum.FileChecksumExtensions;
import io.github.astrapi69.crypt.api.algorithm.MdAlgorithm;
Expand Down Expand Up @@ -63,7 +64,7 @@ public class FileEncryptDecryptorTest extends AbstractTestCase<String, String>
* Sets up method will be invoked before every unit test method in this class
*/
@Override
@BeforeMethod
@BeforeEach
protected void setUp()
{
cryptDir = new File(PathFinder.getSrcTestResourcesDir(), "crypt");
Expand Down Expand Up @@ -112,12 +113,14 @@ public void testEncryptDecryptConstructorFiles() throws Exception
* @throws Exception
* is thrown if any error occurs on the execution
*/
@Test(expectedExceptions = FileNotFoundException.class)
@Test
public void testEncryptDecryptConstructorFilesThrowFileNotFoundException() throws Exception
{
// new scenario...
encryptor = new FileEncryptor(cryptModel, new File(cryptDir, "foodenc"));
encrypted = encryptor.encrypt(dirToEncrypt);
Assertions.assertThrows(FileNotFoundException.class, () -> {
// new scenario...
encryptor = new FileEncryptor(cryptModel, new File(cryptDir, "foodenc"));
encrypted = encryptor.encrypt(dirToEncrypt);
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
*/
package io.github.astrapi69.mystic.crypt.file;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;

import javax.crypto.Cipher;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.crypt.api.algorithm.SunJCEAlgorithm;
import io.github.astrapi69.crypt.data.model.CryptModel;
Expand Down Expand Up @@ -62,7 +62,7 @@ public class GenericObjectEncryptDecryptorTest extends AbstractTestCase<Person,
* Sets up method will be invoked before every unit test method in this class
*/
@Override
@BeforeMethod
@BeforeEach
protected void setUp()
{
cryptDir = new File(PathFinder.getSrcTestResourcesDir(), "crypt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
*/
package io.github.astrapi69.mystic.crypt.file;

import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
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 java.io.File;

import javax.crypto.Cipher;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.checksum.FileChecksumExtensions;
import io.github.astrapi69.crypt.api.algorithm.MdAlgorithm;
Expand Down Expand Up @@ -62,7 +62,7 @@ public class PBEFileDecryptorTest extends AbstractTestCase<String, String>
* Sets up method will be invoked before every unit test method in this class
*/
@Override
@BeforeMethod
@BeforeEach
protected void setUp()
{
cryptDir = new File(PathFinder.getSrcTestResourcesDir(), "crypt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
*/
package io.github.astrapi69.mystic.crypt.file;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;

import javax.crypto.Cipher;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.checksum.FileChecksumExtensions;
import io.github.astrapi69.crypt.api.algorithm.MdAlgorithm;
Expand Down Expand Up @@ -60,7 +60,7 @@ public class PBEFileEncryptorTest extends AbstractTestCase<String, String>
* Sets up method will be invoked before every unit test method in this class
*/
@Override
@BeforeMethod
@BeforeEach
protected void setUp()
{
cryptDir = new File(PathFinder.getSrcTestResourcesDir(), "crypt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
*/
package io.github.astrapi69.mystic.crypt.gm;

import static org.testng.AssertJUnit.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.net.URL;

import org.junit.jupiter.api.Test;
import org.meanbean.test.BeanTester;
import org.testng.annotations.Test;

import io.github.astrapi69.random.object.RandomWebObjectFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
*/
package io.github.astrapi69.mystic.crypt.hex;

import static org.testng.AssertJUnit.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import javax.crypto.Cipher;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.crypt.api.algorithm.AesAlgorithm;
import io.github.astrapi69.crypt.data.model.CryptModel;
Expand All @@ -46,7 +46,7 @@ public class HexableDecryptorTest
/**
* Sets up method will be invoked before every unit test method in this class
*/
@BeforeMethod
@BeforeEach
protected void setUp()
{
firstKey = "1234567890123456";
Expand Down Expand Up @@ -78,8 +78,8 @@ public void testEncryptDecrypt() throws Exception

decryptor = new HexableDecryptor(key);
decryted = decryptor.decrypt(encrypted);
assertTrue("String before encryption is not equal after decryption.",
test.equals(decryted));
assertTrue(test.equals(decryted),
"String before encryption is not equal after decryption.");
}

/**
Expand All @@ -106,8 +106,8 @@ public void testEncryptDecryptWithModel() throws Exception
cryptModel.setOperationMode(Cipher.DECRYPT_MODE);
decryptor = new HexableDecryptor(cryptModel);
decryted = decryptor.decrypt(encrypted);
assertTrue("String before encryption is not equal after decryption.",
test.equals(decryted));
assertTrue(test.equals(decryted),
"String before encryption is not equal after decryption.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
package io.github.astrapi69.mystic.crypt.io;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.io.FileInputStream;
Expand All @@ -40,7 +40,7 @@
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;

import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.crypt.api.algorithm.SunJCEAlgorithm;
import io.github.astrapi69.crypt.api.compound.CompoundAlgorithm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
*/
package io.github.astrapi69.mystic.crypt.io;

import static org.testng.AssertJUnit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import io.github.astrapi69.file.delete.DeleteFileExtensions;
import io.github.astrapi69.file.read.ReadFileExtensions;
Expand Down
Loading

0 comments on commit 3d3e44d

Please sign in to comment.