Merge pull request #7749 from eugenp/BAEL-16669

re-organize testing modules
This commit is contained in:
Loredana Crusoveanu 2019-09-08 18:05:18 +03:00 committed by GitHub
commit 68fc4807c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
97 changed files with 84 additions and 241 deletions

View File

@ -797,9 +797,7 @@
<module>structurizr</module>
<module>struts-2</module>
<module>assertion-libraries</module>
<module>testing-modules</module>
<module>testing-modules-2</module>
<module>twilio</module>
<module>twitter4j</module>
@ -1494,9 +1492,7 @@
<module>structurizr</module>
<module>struts-2</module>
<module>assertion-libraries</module>
<module>testing-modules</module>
<module>testing-modules-2</module>
<module>twilio</module>
<module>twitter4j</module>

View File

@ -1,5 +0,0 @@
## Testing Modules
This is a aggregator module containing several modules focused on testing libraries 2.

View File

@ -1,5 +1,4 @@
## Testing Modules
This is a aggregator module containing several modules focused on testing libraries.
This is a aggregator module containing several modules focused on testing libraries.

View File

@ -0,0 +1,13 @@
## Relevant Articles
- [AssertJs Java 8 Features](http://www.baeldung.com/assertJ-java-8-features)
- [AssertJ for Guava](http://www.baeldung.com/assertJ-for-guava)
- [Introduction to AssertJ](http://www.baeldung.com/introduction-to-assertj)
- [Testing with Google Truth](http://www.baeldung.com/google-truth)
- [Testing with JGoTesting](http://www.baeldung.com/jgotesting)
- [Guide to JSpec](http://www.baeldung.com/jspec)
- [Custom Assertions with AssertJ](http://www.baeldung.com/assertj-custom-assertion)
- [Using Conditions with AssertJ Assertions](http://www.baeldung.com/assertj-conditions)
- [AssertJ Exception Assertions](http://www.baeldung.com/assertj-exception-assertion)

View File

@ -8,9 +8,8 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
<artifactId>testing-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
@ -47,7 +46,6 @@
<version>${jgotesting.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -74,8 +72,4 @@
<jgotesting.version>0.12</jgotesting.version>
</properties>
</project>

View File

@ -1,3 +1,5 @@
### Relevant Articles
- [Guide to JUnit 4 Rules](https://www.baeldung.com/junit-4-rules)
- [Custom JUnit 4 Test Runners](http://www.baeldung.com/junit-4-custom-runners)
- [Introduction to JUnitParams](http://www.baeldung.com/junit-params)

View File

@ -2,3 +2,10 @@
- [EasyMock Argument Matchers](http://www.baeldung.com/easymock-argument-matchers)
- [Mock Static Method using JMockit](https://www.baeldung.com/jmockit-static-method)
- [Mockito vs EasyMock vs JMockit](http://www.baeldung.com/mockito-vs-easymock-vs-jmockit)
- [Introduction to EasyMock](http://www.baeldung.com/easymock)
- [JMockit 101](http://www.baeldung.com/jmockit-101)
- [A Guide to JMockit Expectations](http://www.baeldung.com/jmockit-expectations)
- [JMockit Advanced Usage](http://www.baeldung.com/jmockit-advanced-usage)
- [Introduction to Jukito](http://www.baeldung.com/jukito)
- [A Guide to JavaFaker](https://www.baeldung.com/java-faker)

View File

@ -1,26 +0,0 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>javafaker</artifactId>
<name>javafaker</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>mocks</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>${javafaker.version}</version>
</dependency>
</dependencies>
<properties>
<javafaker.version>0.15</javafaker.version>
</properties>
</project>

View File

@ -1,9 +0,0 @@
=========
## JMockit related tutorials
### Relevant Articles:
- [JMockit 101](http://www.baeldung.com/jmockit-101)
- [A Guide to JMockit Expectations](http://www.baeldung.com/jmockit-expectations)
- [JMockit Advanced Usage](http://www.baeldung.com/jmockit-advanced-usage)

View File

@ -1,37 +0,0 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>jmockit</artifactId>
<name>jmockit</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>mocks</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>jmockit</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<jmockit.version>1.24</jmockit.version>
</properties>
</project>

View File

@ -1,27 +0,0 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>jukito</artifactId>
<name>jukito</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>mocks</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.jukito</groupId>
<artifactId>jukito</artifactId>
<version>${jukito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<jukito.version>1.5</jukito.version>
</properties>
</project>

View File

@ -1,8 +0,0 @@
=========
## Mock comparison realated tutorials
### Relevant Articles:
- [Mockito vs EasyMock vs JMockit](http://www.baeldung.com/mockito-vs-easymock-vs-jmockit)
- [Introduction to EasyMock](http://www.baeldung.com/easymock)

View File

@ -1,54 +0,0 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>mock-comparisons</artifactId>
<name>mock-comparisons</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>mocks</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>${easymock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>mock-comparisons</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<mockito.version>2.21.0</mockito.version>
<easymock.version>3.5.1</easymock.version>
<jmockit.version>1.41</jmockit.version>
</properties>
</project>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -3,7 +3,6 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>mocks</artifactId>
<name>mocks</name>
<packaging>pom</packaging>
<parent>
<groupId>com.baeldung</groupId>
@ -12,9 +11,45 @@
<relativePath>../../</relativePath>
</parent>
<modules>
<module>mock-comparisons</module>
<module>jmockit</module>
</modules>
<dependencies>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>${javafaker.version}</version>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jukito</groupId>
<artifactId>jukito</artifactId>
<version>${jukito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>${easymock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<javafaker.version>0.15</javafaker.version>
<jukito.version>1.5</jukito.version>
<mockito.version>2.21.0</mockito.version>
<easymock.version>3.5.1</easymock.version>
<jmockit.version>1.41</jmockit.version>
</properties>
</project>

View File

@ -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");
});
}
}

View File

@ -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<MultiMock extends List<String>
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<MultiMock extends List<String>
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() {

View File

@ -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();

View File

@ -2,8 +2,8 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>testing-libraries</artifactId>
<name>testing-libraries</name>
<artifactId>testing-modules</artifactId>
<name>testing-modules</name>
<packaging>pom</packaging>
<parent>
@ -14,6 +14,7 @@
</parent>
<modules>
<module>assertion-libraries</module>
<module>easy-random</module>
<module>gatling</module>
<module>groovy-spock</module>
@ -37,5 +38,6 @@
<module>junit-5-advanced</module>
<module>xmlunit-2</module>
<module>junit-4</module>
<module>testing-libraries</module>
</modules>
</project>

View File

@ -0,0 +1,10 @@
## Relevant Articles
- [Mutation Testing with PITest](http://www.baeldung.com/java-mutation-testing-with-pitest)
- [Intro to JaCoCo](http://www.baeldung.com/jacoco)
- [Cucumber and Scenario Outline](http://www.baeldung.com/cucumber-scenario-outline)
- [Cucumber Java 8 Support](http://www.baeldung.com/cucumber-java-8-support)
- [Introduction to Lambda Behave](http://www.baeldung.com/lambda-behave)
- [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java)

View File

@ -2,15 +2,13 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>testing-modules-2</artifactId>
<name>testing-modules-2</name>
<packaging>pom</packaging>
<artifactId>testing-libraries</artifactId>
<name>testing-libraries</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<artifactId>testing-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<dependencies>

View File

@ -1,4 +1,4 @@
package com.baeldung.testing.mutation;
package com.baeldung.mutation;
public class Palindrome {