From e7f8e508321084ee51f83ff444c3632ee2a693a2 Mon Sep 17 00:00:00 2001 From: Asterios Raptis Date: Wed, 3 Jul 2024 18:03:52 +0200 Subject: [PATCH] added new test dependency org.junit.jupiter:junit-jupiter in version 5.11.0-M2 - remove of test dependency testng --- CHANGELOG.md | 3 +- gradle/dependencies.gradle | 2 +- gradle/libs.versions.toml | 11 +++-- gradle/testing.gradle | 2 +- .../random/RandomCharactersTest.java | 4 +- .../random/SecureRandomBeanTest.java | 4 +- .../random/SecureRandomBuilderTest.java | 4 +- .../random/SecureRandomFactoryTest.java | 7 ++-- .../address/RandomAddressExtensionsTest.java | 25 +++++------ .../random/date/RandomDateFactoryTest.java | 22 +++++----- .../number/RandomBigDecimalFactoryTest.java | 4 +- .../number/RandomBigIntegerFactoryTest.java | 8 ++-- .../number/RandomBooleanFactoryTest.java | 9 ++-- .../random/number/RandomByteFactoryTest.java | 4 +- .../random/number/RandomCharFactoryTest.java | 6 +-- .../number/RandomDoubleFactoryTest.java | 34 +++++++-------- .../random/number/RandomFloatFactoryTest.java | 42 +++++++++---------- .../random/number/RandomIntFactoryTest.java | 39 +++++++++-------- .../random/number/RandomLongFactoryTest.java | 40 +++++++++--------- .../number/RandomNumberExtensionsTest.java | 18 ++++---- .../random/number/RandomShortFactoryTest.java | 6 +-- .../RandomObjectFactoryParameterizedTest.java | 29 +++++++------ .../object/RandomObjectFactoryTest.java | 36 ++++++++-------- .../object/RandomStringFactoryTest.java | 10 ++--- .../object/RandomWebObjectFactoryTest.java | 22 ++++++---- .../random/util/PropertiesLoaderTest.java | 8 ++-- 26 files changed, 203 insertions(+), 196 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ad325..a444a13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Version 10.3-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 - update gradle to new version 8.8 - update of com.github.ben-manes.versions.gradle.plugin to new version 0.51.0 @@ -16,7 +17,7 @@ ADDED: - update of dependency jobj-core to new version 8.2 - update of dependency silly-collection to new version 27.1 - update of test dependency equalsverifier to new version 3.16.1 -- update of test dependency testng to new version 7.10.2 +- remove of test dependency testng Version 10.2 ------------- diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index cc59f4e..cf25a65 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -10,7 +10,7 @@ dependencies { testImplementation libs.silly.strings testImplementation libs.test.object testImplementation libs.meanbean - testImplementation libs.testng // Note: use of bundles... testImplementation libs.bundles.unit.testing + testRuntimeOnly libs.junit.platform.launcher } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 86fd8a1..493d647 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,10 +14,15 @@ silly-collection-version = "27.1" silly-math-version = "2.3" silly-strings-version = "9" test-object-version = "8.2" -testng-version = "7.10.2" vintage-time-version = "6" +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" } commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3-version" } equalsverifier = { module = "nl.jqno.equalsverifier:equalsverifier", version.ref = "equalsverifier-version" } jobj-copy = { module = "io.github.astrapi69:jobj-copy", version.ref = "jobj-copy-version" } @@ -28,14 +33,14 @@ silly-collection = { module = "io.github.astrapi69:silly-collection", version.re silly-math = { module = "io.github.astrapi69:silly-math", version.ref = "silly-math-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" } vintage-time = { module = "io.github.astrapi69:vintage-time", version.ref = "vintage-time-version" } [bundles] unit-testing = [ "meanbean", "test-object", - "testng", + "junit-jupiter", + "junit-jupiter-params", ] [plugins] diff --git a/gradle/testing.gradle b/gradle/testing.gradle index dd41a53..a1d164b 100644 --- a/gradle/testing.gradle +++ b/gradle/testing.gradle @@ -1,6 +1,6 @@ test { - useTestNG() + useJUnitPlatform() } jacocoTestReport { diff --git a/src/test/java/io/github/astrapi69/random/RandomCharactersTest.java b/src/test/java/io/github/astrapi69/random/RandomCharactersTest.java index aa3449b..cf7e3e4 100644 --- a/src/test/java/io/github/astrapi69/random/RandomCharactersTest.java +++ b/src/test/java/io/github/astrapi69/random/RandomCharactersTest.java @@ -24,9 +24,9 @@ */ package io.github.astrapi69.random; -import static org.testng.AssertJUnit.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import io.github.astrapi69.test.base.AbstractTestCase; diff --git a/src/test/java/io/github/astrapi69/random/SecureRandomBeanTest.java b/src/test/java/io/github/astrapi69/random/SecureRandomBeanTest.java index 4ca696b..4f286a2 100644 --- a/src/test/java/io/github/astrapi69/random/SecureRandomBeanTest.java +++ b/src/test/java/io/github/astrapi69/random/SecureRandomBeanTest.java @@ -24,10 +24,10 @@ */ package io.github.astrapi69.random; -import static org.testng.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import nl.jqno.equalsverifier.EqualsVerifier; diff --git a/src/test/java/io/github/astrapi69/random/SecureRandomBuilderTest.java b/src/test/java/io/github/astrapi69/random/SecureRandomBuilderTest.java index ea0773b..db57ea2 100644 --- a/src/test/java/io/github/astrapi69/random/SecureRandomBuilderTest.java +++ b/src/test/java/io/github/astrapi69/random/SecureRandomBuilderTest.java @@ -24,13 +24,13 @@ */ package io.github.astrapi69.random; -import static org.testng.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.security.SecureRandom; import java.time.LocalDate; import java.time.ZoneOffset; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; /** * The unit test class for the class {@link SecureRandomBuilder}. diff --git a/src/test/java/io/github/astrapi69/random/SecureRandomFactoryTest.java b/src/test/java/io/github/astrapi69/random/SecureRandomFactoryTest.java index dc42ff6..c48f3c0 100644 --- a/src/test/java/io/github/astrapi69/random/SecureRandomFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/SecureRandomFactoryTest.java @@ -24,16 +24,16 @@ */ package io.github.astrapi69.random; -import static org.testng.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.lang.reflect.InvocationTargetException; import java.security.SecureRandom; import java.time.LocalDate; import java.time.ZoneOffset; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTestException; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; /** * The unit test class for the class {@link SecureRandomFactory} @@ -89,8 +89,7 @@ public void testNewSecureRandomAlgorithmProviderSeed() /** * Test method for {@link SecureRandomFactory} with {@link BeanTester} */ - @Test(enabled = false, expectedExceptions = { BeanTestException.class, - InvocationTargetException.class, UnsupportedOperationException.class }) + @Test public void testWithBeanTester() { final BeanTester beanTester = new BeanTester(); diff --git a/src/test/java/io/github/astrapi69/random/address/RandomAddressExtensionsTest.java b/src/test/java/io/github/astrapi69/random/address/RandomAddressExtensionsTest.java index c80951c..64db324 100644 --- a/src/test/java/io/github/astrapi69/random/address/RandomAddressExtensionsTest.java +++ b/src/test/java/io/github/astrapi69/random/address/RandomAddressExtensionsTest.java @@ -27,14 +27,15 @@ */ package io.github.astrapi69.random.address; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.IOException; import java.util.Properties; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.AssertJUnit; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import io.github.astrapi69.random.util.PropertiesLoader; import io.github.astrapi69.string.StringExtensions; @@ -53,7 +54,7 @@ public class RandomAddressExtensionsTest extends BaseTestCase * {@inheritDoc} */ @Override - @BeforeMethod + @BeforeEach protected void setUp() throws Exception { super.setUp(); @@ -63,7 +64,7 @@ protected void setUp() throws Exception * {@inheritDoc} */ @Override - @AfterMethod + @AfterEach protected void tearDown() throws Exception { super.tearDown(); @@ -82,10 +83,10 @@ public void testGetRandomStreet() throws IOException .loadProperties(RandomAddressExtensions.PROP_FILE_STREETS); final String germanStreet = RandomAddressExtensions.getRandomStreet(germanstreets); actual = germanStreet != null; - AssertJUnit.assertTrue("", actual); + assertTrue(actual); actual = germanstreets.contains(germanStreet); - AssertJUnit.assertTrue("", actual); + assertTrue(actual); } /** @@ -103,11 +104,11 @@ public void testGetRandomStreetWithNumber() throws IOException final String germanStreetWithNumber = RandomAddressExtensions .getRandomStreetWithNumber(germanstreets); actual = germanStreetWithNumber != null; - AssertJUnit.assertTrue("", actual); + assertTrue(actual); final String lastChar = germanStreetWithNumber .substring(germanStreetWithNumber.length() - 1, germanStreetWithNumber.length()); actual = StringExtensions.isNumber(lastChar); - AssertJUnit.assertTrue("", actual); + assertTrue(actual); } /** @@ -124,10 +125,10 @@ public void testGetRandomZip() throws IOException final String randomZip = RandomAddressExtensions.getRandomZip(germanzips); actual = randomZip != null; - AssertJUnit.assertTrue("", actual); + assertTrue(actual); actual = StringExtensions.isNumber(randomZip); - AssertJUnit.assertTrue("", actual); + assertTrue(actual); } /** diff --git a/src/test/java/io/github/astrapi69/random/date/RandomDateFactoryTest.java b/src/test/java/io/github/astrapi69/random/date/RandomDateFactoryTest.java index ad8533b..acd325e 100644 --- a/src/test/java/io/github/astrapi69/random/date/RandomDateFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/date/RandomDateFactoryTest.java @@ -24,9 +24,9 @@ */ package io.github.astrapi69.random.date; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; import java.text.ParseException; @@ -36,9 +36,9 @@ import java.time.ZoneId; import java.util.Date; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import io.github.astrapi69.date.CalculateDateExtensions; import io.github.astrapi69.date.DatePattern; @@ -61,7 +61,7 @@ public class RandomDateFactoryTest /** The date for now. */ private Date now; - @BeforeMethod + @BeforeEach protected void setUp() { this.now = new Date(System.currentTimeMillis()); @@ -96,7 +96,7 @@ public void testCreateRandomBirthdayDateDate() { final Date randomBirthday = RandomDateFactory.randomBirthday(from, till); actual = CalculateDateExtensions.isBetween(from, till, randomBirthday); - assertTrue("", actual); + assertTrue(actual); } } @@ -112,7 +112,7 @@ public void testCreateRandomDateBetween() final Date till = CalculateDateExtensions.addDays(this.now, 30); final Date randomDate = RandomDateFactory.randomDateBetween(from, startDays, endDays); actual = CalculateDateExtensions.isBetween(this.now, till, randomDate); - assertTrue("", actual); + assertTrue(actual); } /** @@ -125,7 +125,7 @@ public void testCreateRandomDatebetweenDateDate() final Date start = this.now; final Date randomDate = RandomDateFactory.randomDatebetween(start, end); actual = CalculateDateExtensions.isBetween(start, end, randomDate); - assertTrue("", actual); + assertTrue(actual); } /** @@ -144,7 +144,7 @@ public void testCreateRandomDatebetweenLongLong() throws ParseException final Date compare = ParseDateExtensions.parseToDate(randomDate, DatePattern.DOT_DD_MM_YYYY_HH_MM_SS.getValue()); actual = CalculateDateExtensions.isBetween(this.now, till, compare); - assertTrue("", actual); + assertTrue(actual); } /** @@ -164,7 +164,7 @@ public void testCreateRandomDatebetweenLongLongString() throws ParseException final String randomDate = RandomDateFactory.randomDatebetween(startDate, endDate, format); final Date compare = ParseDateExtensions.parseToDate(randomDate, format); actual = CalculateDateExtensions.isBetween(from, till, compare); - assertTrue("", actual); + assertTrue(actual); } /** diff --git a/src/test/java/io/github/astrapi69/random/number/RandomBigDecimalFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomBigDecimalFactoryTest.java index 34bbb2e..ece8564 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomBigDecimalFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomBigDecimalFactoryTest.java @@ -24,13 +24,13 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.math.BigDecimal; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.random.DefaultSecureRandom; diff --git a/src/test/java/io/github/astrapi69/random/number/RandomBigIntegerFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomBigIntegerFactoryTest.java index 6ae7dd6..e0b202a 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomBigIntegerFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomBigIntegerFactoryTest.java @@ -24,13 +24,13 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.math.BigInteger; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.random.DefaultSecureRandom; @@ -67,7 +67,7 @@ public void testRandomBigIntegerSecureRandom() /** * Test method for {@link RandomBigIntegerFactory#randomSerialNumber(SecureRandom)} */ - @Test(enabled = true) + @Test public void testRandomSerialNumberSecureRandom() { for (int i = 0; i < 10; i++) @@ -81,7 +81,7 @@ public void testRandomSerialNumberSecureRandom() /** * Test method for {@link RandomBigIntegerFactory#randomSerialNumber()} */ - @Test(enabled = true) + @Test public void testRandomSerialNumber() { for (int i = 0; i < 10; i++) diff --git a/src/test/java/io/github/astrapi69/random/number/RandomBooleanFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomBooleanFactoryTest.java index 71be51b..07d1435 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomBooleanFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomBooleanFactoryTest.java @@ -24,13 +24,12 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.Assert; -import org.testng.annotations.Test; import io.github.astrapi69.random.DefaultSecureRandom; @@ -56,11 +55,11 @@ public void testRandomBooleanSecureRandom() /** * Test method for {@link RandomBooleanFactory#randomBoolean()} */ - @Test(enabled = true) + @Test public void testRandomBoolean() { boolean randomBoolean = RandomBooleanFactory.randomBoolean(); - Assert.assertNotNull(Boolean.valueOf(randomBoolean)); + assertNotNull(Boolean.valueOf(randomBoolean)); } /** diff --git a/src/test/java/io/github/astrapi69/random/number/RandomByteFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomByteFactoryTest.java index 2db4288..08a5f5a 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomByteFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomByteFactoryTest.java @@ -24,12 +24,12 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.math.MathExtensions; import io.github.astrapi69.random.DefaultSecureRandom; diff --git a/src/test/java/io/github/astrapi69/random/number/RandomCharFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomCharFactoryTest.java index 2bba10f..f529600 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomCharFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomCharFactoryTest.java @@ -24,14 +24,14 @@ */ package io.github.astrapi69.random.number; -import static org.testng.Assert.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.nio.CharBuffer; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.random.DefaultSecureRandom; import io.github.astrapi69.random.RandomCharacters; diff --git a/src/test/java/io/github/astrapi69/random/number/RandomDoubleFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomDoubleFactoryTest.java index 69249b3..3623b45 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomDoubleFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomDoubleFactoryTest.java @@ -24,12 +24,12 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.math.MathExtensions; import io.github.astrapi69.random.DefaultSecureRandom; @@ -47,7 +47,7 @@ public class RandomDoubleFactoryTest /** * Test method for {@link RandomDoubleFactory#randomDouble()} */ - @Test(enabled = true) + @Test public void testRandomDouble() { double random = RandomDoubleFactory.randomDouble(); @@ -57,7 +57,7 @@ public void testRandomDouble() /** * Test method for {@link RandomDoubleFactory#randomDoubleBetween(double, double)} */ - @Test(enabled = true) + @Test public void testRandomDoubleBetweenDoubleDouble() { double random = RandomDoubleFactory.randomDoubleBetween(0.0, 10.0); @@ -67,7 +67,7 @@ public void testRandomDoubleBetweenDoubleDouble() /** * Test method for {@link RandomDoubleFactory#randomDouble(double)} */ - @Test(enabled = true) + @Test public void testRandomDoubleDouble() { double random = RandomDoubleFactory @@ -88,24 +88,24 @@ public void testRandomDoubleRandomAlgorithm() for (int i = 0; i < 10; i++) { random = RandomDoubleFactory.randomDouble(5d, algorithm); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1d, 5d, random)); + assertTrue(MathExtensions.isBetween(-1d, 5d, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { random = RandomDoubleFactory.randomDouble(5d, algorithm); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1d, 5d, random)); + assertTrue(MathExtensions.isBetween(-1d, 5d, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { random = RandomDoubleFactory.randomDouble(5d, algorithm); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1d, 5d, random)); + assertTrue(MathExtensions.isBetween(-1d, 5d, random), + "random result is " + random + " but should be between 0-4."); } } @@ -139,24 +139,24 @@ public void testRandomDoubleDoubleRandomAlgorithmSecureRandom() for (int i = 0; i < 10; i++) { random = RandomDoubleFactory.randomDouble(5d, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1d, 5d, random)); + assertTrue(MathExtensions.isBetween(-1d, 5d, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { random = RandomDoubleFactory.randomDouble(5d, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1d, 5d, random)); + assertTrue(MathExtensions.isBetween(-1d, 5d, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { random = RandomDoubleFactory.randomDouble(5d, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1d, 5d, random)); + assertTrue(MathExtensions.isBetween(-1d, 5d, random), + "random result is " + random + " but should be between 0-4."); } } diff --git a/src/test/java/io/github/astrapi69/random/number/RandomFloatFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomFloatFactoryTest.java index c5d724a..e286da8 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomFloatFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomFloatFactoryTest.java @@ -24,12 +24,12 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.math.MathExtensions; import io.github.astrapi69.random.DefaultSecureRandom; @@ -47,7 +47,7 @@ public class RandomFloatFactoryTest /** * Test method for {@link RandomFloatFactory#randomFloat()} */ - @Test(enabled = true) + @Test public void testRandomFloat() { float random = RandomFloatFactory.randomFloat(); @@ -57,7 +57,7 @@ public void testRandomFloat() /** * Test method for {@link RandomFloatFactory#randomFloatBetween(float, float)} */ - @Test(enabled = true) + @Test public void testRandomFloatBetweenFloatFloat() { float random = RandomFloatFactory.randomFloatBetween(0.0f, 10.0f); @@ -67,15 +67,15 @@ public void testRandomFloatBetweenFloatFloat() /** * Test method for {@link RandomFloatFactory#randomFloat(float)} */ - @Test(enabled = true) + @Test public void testRandomFloatFloat() { float random; for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5f); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1f, 5f, random)); + assertTrue(MathExtensions.isBetween(-1f, 5f, random), + "random result is " + random + " but should be between 0-4."); } } @@ -92,24 +92,24 @@ public void testRandomFloatRandomAlgorithm() for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5f, algorithm); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1f, 5f, random)); + assertTrue(MathExtensions.isBetween(-1f, 5f, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5f, algorithm); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1f, 5f, random)); + assertTrue(MathExtensions.isBetween(-1f, 5f, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5f, algorithm); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1f, 5f, random)); + assertTrue(MathExtensions.isBetween(-1f, 5f, random), + "random result is " + random + " but should be between 0-4."); } } @@ -142,24 +142,24 @@ public void testRandomFloatFloatRandomAlgorithmSecureRandom() for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5F, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1F, 5F, random)); + assertTrue(MathExtensions.isBetween(-1F, 5F, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5F, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1F, 5F, random)); + assertTrue(MathExtensions.isBetween(-1F, 5F, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5F, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1F, 5F, random)); + assertTrue(MathExtensions.isBetween(-1F, 5F, random), + "random result is " + random + " but should be between 0-4."); } } @@ -173,8 +173,8 @@ public void testRandomFloatFloatSecureRandom() for (int i = 0; i < 10; i++) { random = RandomFloatFactory.randomFloat(5f, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1f, 5f, random)); + assertTrue(MathExtensions.isBetween(-1f, 5f, random), + "random result is " + random + " but should be between 0-4."); } } diff --git a/src/test/java/io/github/astrapi69/random/number/RandomIntFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomIntFactoryTest.java index 6cd7073..fb24e86 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomIntFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomIntFactoryTest.java @@ -24,13 +24,13 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; import java.util.Map; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.collection.map.MapFactory; import io.github.astrapi69.math.MathExtensions; @@ -89,24 +89,24 @@ public void testRandomIntIntRandomAlgorithmSecureRandom() for (int i = 0; i < 10; i++) { random = RandomIntFactory.randomInt(5, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, random)); + assertTrue(MathExtensions.isBetween(-1, 5, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { random = RandomIntFactory.randomInt(5, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, random)); + assertTrue(MathExtensions.isBetween(-1, 5, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { random = RandomIntFactory.randomInt(5, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, random)); + assertTrue(MathExtensions.isBetween(-1, 5, random), + "random result is " + random + " but should be between 0-4."); } } @@ -120,8 +120,8 @@ public void testRandomIntIntSecureRandom() for (int i = 0; i < 10; i++) { random = RandomIntFactory.randomInt(5, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, random)); + assertTrue(MathExtensions.isBetween(-1, 5, random), + "random result is " + random + " but should be between 0-4."); } } @@ -138,7 +138,7 @@ public void testRandomIntSecureRandom() /** * Test method for {@link RandomIntFactory#randomInt()} */ - @Test(enabled = true) + @Test public void testRandomInt() { int random = RandomIntFactory.randomInt(); @@ -203,8 +203,8 @@ public void testRandomIntInt() for (int i = 0; i < 10; i++) { final int randomInt = RandomIntFactory.randomInt(5); - assertTrue("randomInt result is " + randomInt + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, randomInt)); + assertTrue(MathExtensions.isBetween(-1, 5, randomInt), + "randomInt result is " + randomInt + " but should be between 0-4."); } } @@ -220,26 +220,25 @@ public void testRandomIntRandomAlgorithm() for (int i = 0; i < 10; i++) { final int randomInt = RandomIntFactory.randomInt(5, algorithm); - assertTrue("randomInt result is " + randomInt + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, randomInt)); + assertTrue(MathExtensions.isBetween(-1, 5, randomInt), + "randomInt result is " + randomInt + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { final int randomInt = RandomIntFactory.randomInt(5, algorithm); - assertTrue("randomInt result is " + randomInt + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, randomInt)); + assertTrue(MathExtensions.isBetween(-1, 5, randomInt), + "randomInt result is " + randomInt + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { final int randomInt = RandomIntFactory.randomInt(5, algorithm); - assertTrue( + assertTrue(MathExtensions.isBetween(Integer.MIN_VALUE, Integer.MAX_VALUE, randomInt), "randomInt result is " + randomInt - + " but should be between Integer.MIN_VALUE-Integer.MAX_VALUE.", - MathExtensions.isBetween(Integer.MIN_VALUE, Integer.MAX_VALUE, randomInt)); + + " but should be between Integer.MIN_VALUE-Integer.MAX_VALUE."); } } diff --git a/src/test/java/io/github/astrapi69/random/number/RandomLongFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomLongFactoryTest.java index 1c4276e..2dc1248 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomLongFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomLongFactoryTest.java @@ -24,12 +24,12 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.math.MathExtensions; import io.github.astrapi69.random.DefaultSecureRandom; @@ -72,24 +72,24 @@ public void testRandomLongLongRandomAlgorithmSecureRandom() for (int i = 0; i < 10; i++) { random = RandomLongFactory.randomLong(5L, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1L, 5L, random)); + assertTrue(MathExtensions.isBetween(-1L, 5L, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { random = RandomLongFactory.randomLong(5L, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1L, 5L, random)); + assertTrue(MathExtensions.isBetween(-1L, 5L, random), + "random result is " + random + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { random = RandomLongFactory.randomLong(5L, algorithm, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1L, 5L, random)); + assertTrue(MathExtensions.isBetween(-1L, 5L, random), + "random result is " + random + " but should be between 0-4."); } } @@ -103,8 +103,8 @@ public void testRandomLongLongSecureRandom() for (int i = 0; i < 10; i++) { random = RandomLongFactory.randomLong(5L, DefaultSecureRandom.get()); - assertTrue("random result is " + random + " but should be between 0-4.", - MathExtensions.isBetween(-1L, 5L, random)); + assertTrue(MathExtensions.isBetween(-1L, 5L, random), + "random result is " + random + " but should be between 0-4."); } } @@ -121,7 +121,7 @@ public void testRandomLongSecureRandom() /** * Test method for {@link RandomLongFactory#randomLong()} */ - @Test(enabled = true) + @Test public void testRandomLong() { long random = RandomLongFactory.randomLong(); @@ -131,14 +131,14 @@ public void testRandomLong() /** * Test method for {@link RandomLongFactory#randomLong(long)} */ - @Test(enabled = true) + @Test public void testRandomLongLong() { for (int i = 0; i < 10; i++) { final long randomLong = RandomLongFactory.randomLong(5l); - assertTrue("randomLong result is " + randomLong + " but should be between 0-4.", - MathExtensions.isBetween(-1, 5, randomLong)); + assertTrue(MathExtensions.isBetween(-1, 5, randomLong), + "randomLong result is " + randomLong + " but should be between 0-4."); } } @@ -155,24 +155,24 @@ public void testRandomLongRandomAlgorithm() for (int i = 0; i < 10; i++) { randomLong = RandomLongFactory.randomLong(5l, algorithm); - assertTrue("randomLong result is " + randomLong + " but should be between 0-4.", - MathExtensions.isBetween(-1l, 5l, randomLong)); + assertTrue(MathExtensions.isBetween(-1l, 5l, randomLong), + "randomLong result is " + randomLong + " but should be between 0-4."); } // scenario with RandomAlgorithm.MATH_RANDOM algorithm = RandomAlgorithm.MATH_RANDOM; for (int i = 0; i < 10; i++) { randomLong = RandomLongFactory.randomLong(5l, algorithm); - assertTrue("randomLong result is " + randomLong + " but should be between 0-4.", - MathExtensions.isBetween(-1l, 5l, randomLong)); + assertTrue(MathExtensions.isBetween(-1l, 5l, randomLong), + "randomLong result is " + randomLong + " but should be between 0-4."); } // scenario with RandomAlgorithm.RANDOM algorithm = RandomAlgorithm.RANDOM; for (int i = 0; i < 10; i++) { randomLong = RandomLongFactory.randomLong(5l, algorithm); - assertTrue("randomLong result is " + randomLong + " but should be between 0-4.", - MathExtensions.isBetween(-1l, 5l, randomLong)); + assertTrue(MathExtensions.isBetween(-1l, 5l, randomLong), + "randomLong result is " + randomLong + " but should be between 0-4."); } } diff --git a/src/test/java/io/github/astrapi69/random/number/RandomNumberExtensionsTest.java b/src/test/java/io/github/astrapi69/random/number/RandomNumberExtensionsTest.java index 1bcd76c..0320367 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomNumberExtensionsTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomNumberExtensionsTest.java @@ -24,13 +24,13 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import io.github.astrapi69.string.StringExtensions; import io.github.astrapi69.test.base.BaseTestCase; @@ -50,7 +50,7 @@ public class RandomNumberExtensionsTest extends BaseTestCase * {@inheritDoc} */ @Override - @BeforeMethod + @BeforeEach protected void setUp() throws Exception { super.setUp(); @@ -60,7 +60,7 @@ protected void setUp() throws Exception * {@inheritDoc} */ @Override - @AfterMethod + @AfterEach protected void tearDown() throws Exception { super.tearDown(); @@ -69,7 +69,7 @@ protected void tearDown() throws Exception /** * Test method for {@link RandomNumberExtensions#getRandomNumberString(int, int)} */ - @Test(enabled = true) + @Test public void testGetRandomFloatString() { int beforeComma; @@ -86,7 +86,7 @@ public void testGetRandomFloatString() /** * Test method for {@link RandomNumberExtensions#getRandomNumericString()} */ - @Test(enabled = true) + @Test public void testGetRandomNumericString() { String randomNumericString = RandomNumberExtensions.getRandomNumericString(); diff --git a/src/test/java/io/github/astrapi69/random/number/RandomShortFactoryTest.java b/src/test/java/io/github/astrapi69/random/number/RandomShortFactoryTest.java index 2a4faf4..901b3b2 100644 --- a/src/test/java/io/github/astrapi69/random/number/RandomShortFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/number/RandomShortFactoryTest.java @@ -24,12 +24,12 @@ */ package io.github.astrapi69.random.number; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.security.SecureRandom; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.math.MathExtensions; import io.github.astrapi69.random.DefaultSecureRandom; @@ -46,7 +46,7 @@ public class RandomShortFactoryTest /** * Test method for {@link RandomShortFactory#randomShort()} */ - @Test(enabled = true) + @Test public void testRandomShort() { for (int i = 0; i < 10; i++) diff --git a/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryParameterizedTest.java b/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryParameterizedTest.java index 523d906..7be488c 100644 --- a/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryParameterizedTest.java +++ b/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryParameterizedTest.java @@ -24,10 +24,13 @@ */ package io.github.astrapi69.random.object; -import static org.testng.AssertJUnit.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.FieldSource; import io.github.astrapi69.test.object.A; import io.github.astrapi69.test.object.AlgorithmModel; @@ -62,19 +65,15 @@ public class RandomObjectFactoryParameterizedTest public static final String TEST_OBJECTS = "testObjects"; - @DataProvider(name = TEST_OBJECTS) - public static Object[][] testObjects() - { - return new Object[][] { { Person.class }, { AnnotatedClass.class }, - { AnnotatedTestClass.class }, { ClassExtendsAnnotatedInterface.class }, - { SubAnnotatedClass.class }, { AccessRight.class }, { Roles.class }, { Role.class }, - { AlgorithmModel.class }, { A.class }, { ClonableObject.class }, { Company.class }, - { Customer.class }, { EmployeeList.class }, { Employee.class }, { Light.class }, - { Member.class }, { NotSerializable.class }, { Permission.class }, { Person.class }, - { PremiumMember.class }, { Television.class }, }; - } + static List testClasses = Arrays.asList(Person.class, AnnotatedClass.class, + AnnotatedTestClass.class, ClassExtendsAnnotatedInterface.class, SubAnnotatedClass.class, + AccessRight.class, Roles.class, Role.class, AlgorithmModel.class, A.class, + ClonableObject.class, Company.class, Customer.class, EmployeeList.class, Employee.class, + Light.class, Member.class, NotSerializable.class, Permission.class, Person.class, + PremiumMember.class, Television.class); - @Test(dataProvider = TEST_OBJECTS) + @ParameterizedTest + @FieldSource("testClasses") public void test(Class val) throws NoSuchFieldException, IllegalAccessException, InstantiationException { diff --git a/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryTest.java b/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryTest.java index 4360604..adbf140 100644 --- a/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/object/RandomObjectFactoryTest.java @@ -24,11 +24,11 @@ */ package io.github.astrapi69.random.object; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNull; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.awt.Point; import java.nio.charset.Charset; @@ -41,8 +41,8 @@ import java.util.UUID; import org.apache.commons.lang3.ArrayUtils; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.collection.list.ListFactory; import io.github.astrapi69.math.MathExtensions; @@ -214,8 +214,8 @@ public void testRandomEnum() final Gender randomEnumEntry = RandomObjectFactory.randomEnumFromObject(enumEntry); final Gender[] genders = Gender.values(); - assertTrue("Enum value should contain the random value.", - ArrayUtils.contains(genders, randomEnumEntry)); + assertTrue(ArrayUtils.contains(genders, randomEnumEntry), + "Enum value should contain the random value."); } /** @@ -226,8 +226,8 @@ public void testRandomEnumArray() { final Gender[] genders = Gender.values(); final Gender randomEnumEntry = RandomObjectFactory.randomEnumFromEnumValues(genders); - assertTrue("Enum value should contain the random value.", - ArrayUtils.contains(genders, randomEnumEntry)); + assertTrue(ArrayUtils.contains(genders, randomEnumEntry), + "Enum value should contain the random value."); } /** @@ -239,8 +239,8 @@ public void testRandomEnumClass() final Gender randomEnumEntry = RandomObjectFactory.randomEnumFromClass(Gender.class); final Gender[] genders = Gender.values(); - assertTrue("Enum value should contain the random value.", - ArrayUtils.contains(genders, randomEnumEntry)); + assertTrue(ArrayUtils.contains(genders, randomEnumEntry), + "Enum value should contain the random value."); } /** @@ -266,8 +266,8 @@ public void testRandomEnumString() Gender randomEnumEntry = RandomObjectFactory.randomEnumFromClassname(enumClassName); final Gender[] genders = Gender.values(); - assertTrue("Enum value should contain the random value.", - ArrayUtils.contains(genders, randomEnumEntry)); + assertTrue(ArrayUtils.contains(genders, randomEnumEntry), + "Enum value should contain the random value."); enumClassName = "Gender"; randomEnumEntry = RandomObjectFactory.randomEnumFromClassname(enumClassName); @@ -301,7 +301,7 @@ public void testRandomKey() /** * Test method for {@link RandomObjectFactory#randomPixel()} */ - @Test(enabled = true) + @Test public void testRandomPixel() { int random = RandomObjectFactory.randomPixel(); @@ -311,7 +311,7 @@ public void testRandomPixel() /** * Test method for {@link RandomObjectFactory#newSalt()} */ - @Test(enabled = true) + @Test public void testNewSalt() { byte[] newSalt = RandomObjectFactory.newSalt(); @@ -361,7 +361,7 @@ public void testGetRandomFloatString() /** * Test method for {@link RandomObjectFactory#newRandomAlgorithm()} */ - @Test(enabled = true) + @Test public void testNewRandomAlgorithm() { RandomAlgorithm randomAlgorithm = RandomObjectFactory.newRandomAlgorithm(); @@ -371,7 +371,7 @@ public void testNewRandomAlgorithm() /** * Test method for {@link RandomObjectFactory#newRandomByteObjects(int)} */ - @Test(enabled = true) + @Test public void testNewRandomByteObjects() { int actual; diff --git a/src/test/java/io/github/astrapi69/random/object/RandomStringFactoryTest.java b/src/test/java/io/github/astrapi69/random/object/RandomStringFactoryTest.java index 3cd64e0..f32f601 100644 --- a/src/test/java/io/github/astrapi69/random/object/RandomStringFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/object/RandomStringFactoryTest.java @@ -24,16 +24,16 @@ */ package io.github.astrapi69.random.object; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.nio.CharBuffer; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.Test; import io.github.astrapi69.math.MathExtensions; import io.github.astrapi69.random.RandomCharacters; @@ -44,7 +44,7 @@ public class RandomStringFactoryTest /** * Test method for {@link RandomStringFactory#randomHexString(int)} */ - @Test(enabled = true) + @Test public void testRandomHexString() { String randomHexString = RandomStringFactory.randomHexString(16); diff --git a/src/test/java/io/github/astrapi69/random/object/RandomWebObjectFactoryTest.java b/src/test/java/io/github/astrapi69/random/object/RandomWebObjectFactoryTest.java index e357b10..07dde51 100644 --- a/src/test/java/io/github/astrapi69/random/object/RandomWebObjectFactoryTest.java +++ b/src/test/java/io/github/astrapi69/random/object/RandomWebObjectFactoryTest.java @@ -24,16 +24,17 @@ */ package io.github.astrapi69.random.object; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.nio.CharBuffer; import java.util.Optional; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.meanbean.test.BeanTester; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import io.github.astrapi69.random.RandomCharacters; import io.github.astrapi69.test.base.BaseTestCase; @@ -53,7 +54,7 @@ public class RandomWebObjectFactoryTest extends BaseTestCase * {@inheritDoc} */ @Override - @BeforeMethod + @BeforeEach public void setUp() throws Exception { } @@ -62,7 +63,7 @@ public void setUp() throws Exception * {@inheritDoc} */ @Override - @AfterMethod + @AfterEach public void tearDown() throws Exception { } @@ -109,10 +110,13 @@ public void testGetInfomailFromWebsite() /** * Test method for {@link RandomWebObjectFactory#getInfomailFromWebsite(java.lang.String)} . */ - @Test(expectedExceptions = IllegalArgumentException.class) + @Test public void testGetInfomailFromWebsiteExEx() { - RandomWebObjectFactory.getInfomailFromWebsite("htp://ww.g.rw"); + Assertions.assertThrows(IllegalArgumentException.class, () -> { + // ... + RandomWebObjectFactory.getInfomailFromWebsite("htp://ww.g.rw"); + }); } /** diff --git a/src/test/java/io/github/astrapi69/random/util/PropertiesLoaderTest.java b/src/test/java/io/github/astrapi69/random/util/PropertiesLoaderTest.java index 4fca116..66a5da2 100644 --- a/src/test/java/io/github/astrapi69/random/util/PropertiesLoaderTest.java +++ b/src/test/java/io/github/astrapi69/random/util/PropertiesLoaderTest.java @@ -24,12 +24,12 @@ */ package io.github.astrapi69.random.util; -import static org.testng.AssertJUnit.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.util.Properties; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import io.github.astrapi69.lang.PackageExtensions; @@ -45,7 +45,7 @@ public class PropertiesLoaderTest * @throws IOException * Signals that an I/O exception has occurred. */ - @Test(enabled = true) + @Test public void testLoadPropertiesPackagePath() throws IOException { final String propertiesFilename = "resources.properties"; @@ -54,6 +54,6 @@ public void testLoadPropertiesPackagePath() throws IOException final Properties prop = PropertiesLoader.loadProperties(path); final boolean result = null != prop; - assertTrue("", result); + assertTrue(result); } }