Merge branch 'master' into update-links

This commit is contained in:
Loredana Crusoveanu
2019-04-15 23:58:45 +03:00
committed by GitHub
320 changed files with 6087 additions and 582 deletions
+1 -1
View File
@@ -48,7 +48,7 @@
</build>
<properties>
<spock-core.version>1.3-RC1-groovy-2.4</spock-core.version>
<spock-core.version>1.3-groovy-2.4</spock-core.version>
<groovy-all.version>2.4.7</groovy-all.version>
<gmavenplus-plugin.version>1.5</gmavenplus-plugin.version>
</properties>
@@ -7,6 +7,16 @@ import spock.lang.Specification
class IgnoreIfTest extends Specification {
@IgnoreIf({System.getProperty("os.name").contains("windows")})
def "I won't run on windows"() { }
def "I won't run on windows"() {
expect:
true
}
@IgnoreIf({ os.isWindows() })
def "I'm using Spock helper classes to run only on windows"() {
expect:
true
}
}
@@ -2,7 +2,10 @@ import extensions.TimeoutTest
import spock.lang.Issue
runner {
filterStackTrace true
if (System.getenv("FILTER_STACKTRACE") == null) {
filterStackTrace false
}
report {
issueNamePrefix 'Bug '
+1 -1
View File
@@ -6,7 +6,7 @@
- [A Guide to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions)
- [Inject Parameters into JUnit Jupiter Unit Tests](http://www.baeldung.com/junit-5-parameters)
- [Mockito and JUnit 5 Using ExtendWith](http://www.baeldung.com/mockito-junit-5-extension)
- [JUnit 5 @RunWith](http://www.baeldung.com/junit-5-runwith)
- [JUnit 5 @RunWith](http://www.baeldung.com/junit-5-runwith)
- [JUnit 5 @Test Annotation](http://www.baeldung.com/junit-5-test-annotation)
- [Assert an Exception is Thrown in JUnit 4 and 5](http://www.baeldung.com/junit-assert-exception)
- [@Before vs @BeforeClass vs @BeforeEach vs @BeforeAll](http://www.baeldung.com/junit-before-beforeclass-beforeeach-beforeall)
@@ -42,7 +42,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -68,12 +68,12 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<version>${lombok.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -145,6 +145,7 @@
<jmeter.version>5.0</jmeter.version>
<grinder.version>3.11</grinder.version>
<spring.boot.version>2.0.5.RELEASE</spring.boot.version>
<h2.version>1.4.197</h2.version>
</properties>
</project>
@@ -18,7 +18,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class ArithmeticFunctionTest {
public class ArithmeticFunctionUnitTest {
@Test
public void test_addingIntegers_returnsSum() {
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class ComparisonFunctionTest {
public class ComparisonFunctionUnitTest {
@Test
public void test_findMax() {
@@ -5,7 +5,7 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ ComparisonFunctionTest.class, ArithmeticFunctionTest.class })
@SuiteClasses({ ComparisonFunctionUnitTest.class, ArithmeticFunctionUnitTest.class })
public class FunctionTestSuite {
}
@@ -6,6 +6,13 @@
<version>0.0.1-SNAPSHOT</version>
<name>parallel-tests-junit</name>
<packaging>pom</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>
<modules>
<module>math-test-functions</module>
@@ -18,7 +18,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class StringFunctionTest {
public class StringFunctionUnitTest {
@Test
public void test_upperCase() {
+1
View File
@@ -1,3 +1,4 @@
###Relevant Articles:
- [A Guide to REST-assured](http://www.baeldung.com/rest-assured-tutorial)
- [REST-assured Support for Spring MockMvc](https://www.baeldung.com/spring-mock-mvc-rest-assured)
- [Getting and Verifying Response Data with REST-assured](https://www.baeldung.com/rest-assured-response)
+1 -1
View File
@@ -7,7 +7,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
- [Introduction to WireMock](http://www.baeldung.com/introduction-to-wiremock)
- [Using WireMock Scenarios](http://www.baeldung.com/using-wiremock-scenarios)
- [Using WireMock Scenarios](https://www.baeldung.com/wiremock-scenarios)
- [REST API Testing with Cucumber](http://www.baeldung.com/cucumber-rest-api-testing)
- [Testing a REST API with JBehave](http://www.baeldung.com/jbehave-rest-testing)
- [REST API Testing with Karate](http://www.baeldung.com/karate-rest-api-testing)
@@ -1,64 +0,0 @@
package org.baeldung.rest;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.HttpClientBuilder;
import org.hamcrest.Matchers;
import org.junit.Test;
public class GithubBasicLiveTest {
// simple request - response
@Test
public void givenUserDoesNotExists_whenUserInfoIsRetrieved_then404IsReceived() throws ClientProtocolException, IOException {
// Given
final String name = randomAlphabetic(8);
final HttpUriRequest request = new HttpGet("https://api.github.com/users/" + name);
// When
final HttpResponse httpResponse = HttpClientBuilder.create().build().execute(request);
// Then
assertThat(httpResponse.getStatusLine().getStatusCode(), equalTo(HttpStatus.SC_NOT_FOUND));
}
@Test
public void givenRequestWithNoAcceptHeader_whenRequestIsExecuted_thenDefaultResponseContentTypeIsJson() throws ClientProtocolException, IOException {
// Given
final String jsonMimeType = "application/json";
final HttpUriRequest request = new HttpGet("https://api.github.com/users/eugenp");
// When
final HttpResponse response = HttpClientBuilder.create().build().execute(request);
// Then
final String mimeType = ContentType.getOrDefault(response.getEntity()).getMimeType();
assertEquals(jsonMimeType, mimeType);
}
@Test
public void givenUserExists_whenUserInformationIsRetrieved_thenRetrievedResourceIsCorrect() throws ClientProtocolException, IOException {
// Given
final HttpUriRequest request = new HttpGet("https://api.github.com/users/eugenp");
// When
final HttpResponse response = HttpClientBuilder.create().build().execute(request);
// Then
final GitHubUser resource = RetrieveUtil.retrieveResourceFromResponse(response, GitHubUser.class);
assertThat("eugenp", Matchers.is(resource.getLogin()));
}
}
+2 -2
View File
@@ -18,6 +18,6 @@
- [Custom JUnit 4 Test Runners](http://www.baeldung.com/junit-4-custom-runners)
- [Guide to JSpec](http://www.baeldung.com/jspec)
- [Custom Assertions with AssertJ](http://www.baeldung.com/assertj-custom-assertion)
- [Using Conditions with AssertJ](http://www.baeldung.com/assertj-conditions)
- [Guide to JavaFaker](https://www.baeldung.com/java-faker)
- [Using Conditions with AssertJ Assertions](http://www.baeldung.com/assertj-conditions)
- [A Guide to JavaFaker](https://www.baeldung.com/java-faker)
- [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java)
+2 -1
View File
@@ -91,7 +91,7 @@
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>0.15</version>
<version>${javafaker.version}</version>
</dependency>
</dependencies>
@@ -177,6 +177,7 @@
<lambda-behave.version>0.4</lambda-behave.version>
<assertj-guava.version>3.0.0</assertj-guava.version>
<jukito.version>1.5</jukito.version>
<javafaker.version>0.15</javafaker.version>
</properties>
</project>