diff --git a/testing-modules/assertion-libraries/pom.xml b/testing-modules/assertion-libraries/pom.xml
index 274806d336..9d60d42533 100644
--- a/testing-modules/assertion-libraries/pom.xml
+++ b/testing-modules/assertion-libraries/pom.xml
@@ -8,9 +8,8 @@
com.baeldung
- parent-java
- 0.0.1-SNAPSHOT
- ../parent-java
+ testing-modules
+ 1.0.0-SNAPSHOT
@@ -47,7 +46,6 @@
${jgotesting.version}
test
-
@@ -74,8 +72,4 @@
0.12
-
-
-
-
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/AdditionUnitTest.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/AdditionUnitTest.java
deleted file mode 100644
index ae6fa355fa..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/AdditionUnitTest.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class AdditionUnitTest {
- Calculator calculator = new Calculator();
-
- @Test
- public void testAddition() {
- assertEquals("addition", 8, calculator.add(5, 3));
- }
-}
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/AssertionsUnitTest.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/AssertionsUnitTest.java
deleted file mode 100644
index b0209b01aa..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/AssertionsUnitTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.hamcrest.core.IsCollectionContaining.hasItems;
-import static org.junit.Assert.*;
-
-/**
- * Unit test that demonstrate the different assertions available within JUnit 4
- */
-public class AssertionsUnitTest {
-
- @Test
- public void whenAssertingEquality_thenEqual() {
- String expected = "Baeldung";
- String actual = "Baeldung";
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void whenAssertingEqualityWithMessage_thenEqual() {
- String expected = "Baeldung";
- String actual = "Baeldung";
-
- assertEquals("failure - strings are not equal", expected, actual);
- }
-
- @Test
- public void whenAssertingArraysEquality_thenEqual() {
- char[] expected = { 'J', 'u', 'n', 'i', 't' };
- char[] actual = "Junit".toCharArray();
-
- assertArrayEquals(expected, actual);
- }
-
- @Test
- public void givenNullArrays_whenAssertingArraysEquality_thenEqual() {
- int[] expected = null;
- int[] actual = null;
-
- assertArrayEquals(expected, actual);
- }
-
- @Test
- public void whenAssertingNull_thenTrue() {
- Object car = null;
-
- assertNull("The car should be null", car);
- }
-
- @Test
- public void whenAssertingNotNull_thenTrue() {
- Object car = new Object();
-
- assertNotNull("The car should not be null", car);
- }
-
- @Test
- public void whenAssertingNotSameObject_thenDifferent() {
- Object cat = new Object();
- Object dog = new Object();
-
- assertNotSame(cat, dog);
- }
-
- @Test
- public void whenAssertingSameObject_thenSame() {
- Object cat = new Object();
-
- assertSame(cat, cat);
- }
-
- @Test
- public void whenAssertingConditions_thenVerified() {
- assertTrue("5 is greater then 4", 5 > 4);
- assertFalse("5 is not greater then 6", 5 > 6);
- }
-
- @Test
- public void when_thenNotFailed() {
- try {
- methodThatShouldThrowException();
- fail("Exception not thrown");
- } catch (UnsupportedOperationException e) {
- assertEquals("Operation Not Supported", e.getMessage());
- }
- }
-
- private void methodThatShouldThrowException() {
- throw new UnsupportedOperationException("Operation Not Supported");
- }
-
- @Test
- public void testAssertThatHasItems() {
- assertThat(Arrays.asList("Java", "Kotlin", "Scala"), hasItems("Java", "Kotlin"));
- }
-
-}
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/BlockingTestRunner.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/BlockingTestRunner.java
deleted file mode 100644
index 432d5cda83..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/BlockingTestRunner.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-public class BlockingTestRunner extends BlockJUnit4ClassRunner {
- public BlockingTestRunner(Class> klass) throws InitializationError {
- super(klass);
- }
-
- @Override
- protected Statement methodInvoker(FrameworkMethod method, Object test) {
- System.out.println("invoking: " + method.getName());
- return super.methodInvoker(method, test);
- }
-}
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/CalculatorUnitTest.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/CalculatorUnitTest.java
deleted file mode 100644
index d5ca847106..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/CalculatorUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import static org.junit.Assert.assertEquals;
-
-@RunWith(JUnit4.class)
-public class CalculatorUnitTest {
- Calculator calculator = new Calculator();
-
- @Test
- public void testAddition() {
- assertEquals("addition", 8, calculator.add(5, 3));
- }
-}
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/SubstractionUnitTest.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/SubstractionUnitTest.java
deleted file mode 100644
index fd98395ebc..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/SubstractionUnitTest.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class SubstractionUnitTest {
- Calculator calculator = new Calculator();
-
- @Test
- public void substraction() {
- assertEquals("substraction", 2, calculator.sub(5, 3));
- }
-}
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/SuiteUnitTest.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/SuiteUnitTest.java
deleted file mode 100644
index 76d19f84b2..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/SuiteUnitTest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({
- AdditionUnitTest.class,
- SubstractionUnitTest.class})
-public class SuiteUnitTest {
-}
diff --git a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/TestRunner.java b/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/TestRunner.java
deleted file mode 100644
index 9eb4b3141b..0000000000
--- a/testing-modules/assertion-libraries/src/test/java/com/baeldung/junit/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.baeldung.junit;
-
-import org.junit.Test;
-import org.junit.runner.Description;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-
-import java.lang.reflect.Method;
-
-public class TestRunner extends Runner {
-
- private Class testClass;
- public TestRunner(Class testClass) {
- super();
- this.testClass = testClass;
- }
-
- @Override
- public Description getDescription() {
- return Description.createTestDescription(testClass, "My runner description");
- }
-
- @Override
- public void run(RunNotifier notifier) {
- System.out.println("running the tests from MyRunner: " + testClass);
- try {
- Object testObject = testClass.newInstance();
- for (Method method : testClass.getMethods()) {
- if (method.isAnnotationPresent(Test.class)) {
- notifier.fireTestStarted(Description
- .createTestDescription(testClass, method.getName()));
- method.invoke(testObject);
- notifier.fireTestFinished(Description
- .createTestDescription(testClass, method.getName()));
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/testing-modules/mocks/pom.xml b/testing-modules/mocks/pom.xml
index 342191c206..bf75cfc3a2 100644
--- a/testing-modules/mocks/pom.xml
+++ b/testing-modules/mocks/pom.xml
@@ -3,7 +3,6 @@
4.0.0
mocks
mocks
- pom
com.baeldung
diff --git a/testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java b/testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java
index 2c5aa2a3ed..ecdc6e441e 100644
--- a/testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java
+++ b/testing-modules/mocks/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java
@@ -28,17 +28,4 @@ public class AppManagerUnitTest {
Assertions.assertFalse(appManager.managerResponse("Why are you coming late?"));
}
-
- @Test
- public void givenAppManager_whenPrivateStaticMethod_thenValidateExpectedResponse() {
- final int response = Deencapsulation.invoke(AppManager.class, "stringToInteger", "110");
- Assertions.assertEquals(110, response);
- }
-
- @Test
- public void givenAppManager_whenPrivateStaticMethod_thenExpectException() {
- Assertions.assertThrows(IllegalArgumentException.class, () -> {
- Deencapsulation.invoke(AppManager.class, "stringToInteger", "11r");
- });
- }
}
diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java b/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java
index 5cde912277..3a30342eb9 100644
--- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java
+++ b/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/AdvancedCollaboratorIntegrationTest.java
@@ -1,12 +1,10 @@
package org.baeldung.mocks.jmockit;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.List;
-import org.baeldung.mocks.jmockit.AdvancedCollaborator.InnerAdvancedCollaborator;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,12 +50,6 @@ public class AdvancedCollaboratorIntegrationTest
assertEquals(1, coll.i);
}
- @Test
- public void testToCallPrivateMethodsDirectly() {
- Object value = Deencapsulation.invoke(mock, "privateMethod");
- assertEquals("default:", value);
- }
-
@Test
public void testToSetPrivateFieldDirectly() {
Deencapsulation.setField(mock, "privateField", 10);
@@ -70,18 +62,6 @@ public class AdvancedCollaboratorIntegrationTest
assertEquals(5, value);
}
- @Test
- public void testToCreateNewInstanceDirectly() {
- AdvancedCollaborator coll = Deencapsulation.newInstance(AdvancedCollaborator.class, "foo");
- assertEquals(3, coll.i);
- }
-
- @Test
- public void testToCreateNewInnerClassInstanceDirectly() {
- InnerAdvancedCollaborator innerCollaborator = Deencapsulation.newInnerInstance(InnerAdvancedCollaborator.class, mock);
- assertNotNull(innerCollaborator);
- }
-
@Test
@SuppressWarnings("unchecked")
public void testMultipleInterfacesWholeTest() {
diff --git a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java b/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java
index c176cdc182..8b85af6243 100644
--- a/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java
+++ b/testing-modules/mocks/src/test/java/org/baeldung/mocks/jmockit/ExpectationsIntegrationTest.java
@@ -3,7 +3,6 @@ package org.baeldung.mocks.jmockit;
import mockit.Delegate;
import mockit.Expectations;
import mockit.Mocked;
-import mockit.StrictExpectations;
import mockit.Verifications;
import mockit.integration.junit4.JMockit;
import org.hamcrest.BaseMatcher;
@@ -106,7 +105,7 @@ public class ExpectationsIntegrationTest {
@Test
public void testResultAndReturns(@Mocked ExpectationsCollaborator mock) {
- new StrictExpectations() {{
+ new Expectations() {{
mock.methodReturnsString();
result = "foo";
result = new Exception();
diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml
index ab028cee24..7891ebbf6d 100644
--- a/testing-modules/testing-libraries/pom.xml
+++ b/testing-modules/testing-libraries/pom.xml
@@ -4,13 +4,11 @@
4.0.0
testing-libraries
testing-libraries
- pom
com.baeldung
- parent-modules
+ testing-modules
1.0.0-SNAPSHOT
- ..
diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/mutation/Palindrome.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/mutation/Palindrome.java
index e264a4c759..5e6fb7e4da 100644
--- a/testing-modules/testing-libraries/src/main/java/com/baeldung/mutation/Palindrome.java
+++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/mutation/Palindrome.java
@@ -1,4 +1,4 @@
-package com.baeldung.testing.mutation;
+package com.baeldung.mutation;
public class Palindrome {