Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port unit and integration tests to JUnit 5 #432

Merged
merged 2 commits into from
Sep 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion documentation/src/main/cheatsheet/cheatsheets.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
== ServiceAdapterOptions

++++
Options describing how an ServiceAdapter will make connections with external HTTP services.
++++
'''

Expand Down Expand Up @@ -104,6 +103,9 @@ Configure when to collect access log. True if after request arrives, false after
[[AdapterRequest]]
== AdapterRequest

++++
++++
'''

[cols=">25%,^25%,50%"]
[frame="topbot"]
Expand All @@ -125,6 +127,9 @@ Set the client request
[[AdapterResponse]]
== AdapterResponse

++++
++++
'''

[cols=">25%,^25%,50%"]
[frame="topbot"]
Expand Down
12 changes: 0 additions & 12 deletions knotx-adapter/knotx-adapter-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,10 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
Expand Down
10 changes: 1 addition & 9 deletions knotx-adapter/knotx-adapter-service-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,13 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;

@RunWith(VertxUnitRunner.class)
public class HttpClientFacadeTest {
Expand Down Expand Up @@ -80,7 +79,7 @@ public void whenSupportedStaticPathServiceRequested_expectRequestExecutedAndResp
TestContext context) throws Exception {
Async async = context.async();
// given
final WebClient mockedWebClient = PowerMockito.spy(webClient());
final WebClient mockedWebClient = Mockito.spy(webClient());
HttpClientFacade clientFacade = new HttpClientFacade(mockedWebClient,
getConfiguration());
final JsonObject expectedResponse = new JsonObject(FileReader.readText("first-response.json"));
Expand Down Expand Up @@ -109,7 +108,7 @@ public void whenSupportedDynamicPathServiceRequested_expectRequestExecutedAndRes
TestContext context) throws Exception {
Async async = context.async();
// given
final WebClient mockedWebClient = PowerMockito.spy(webClient());
final WebClient mockedWebClient = Mockito.spy(webClient());
HttpClientFacade clientFacade = new HttpClientFacade(mockedWebClient,
getConfiguration());
final JsonObject expectedResponse = new JsonObject(FileReader.readText("first-response.json"));
Expand Down Expand Up @@ -141,7 +140,7 @@ public void whenServiceRequestedWithoutPathParam_expectNoServiceRequestAndBadReq
TestContext context) throws Exception {
Async async = context.async();
// given
final WebClient mockedWebClient = PowerMockito.spy(webClient());
final WebClient mockedWebClient = Mockito.spy(webClient());
HttpClientFacade clientFacade = new HttpClientFacade(mockedWebClient,
getConfiguration());

Expand All @@ -168,7 +167,7 @@ public void whenUnsupportedPathServiceRequested_expectNoServiceRequestAndBadRequ
TestContext context) throws Exception {
Async async = context.async();
// given
final WebClient mockedWebClient = PowerMockito.spy(webClient());
final WebClient mockedWebClient = Mockito.spy(webClient());
HttpClientFacade clientFacade = new HttpClientFacade(mockedWebClient,
getConfiguration());

Expand Down Expand Up @@ -197,7 +196,7 @@ public void whenServiceEmptyResponse_expectNoFailure(
TestContext context) throws Exception {
Async async = context.async();
// given
final WebClient mockedWebClient = PowerMockito.spy(webClient());
final WebClient mockedWebClient = Mockito.spy(webClient());
HttpClientFacade clientFacade = new HttpClientFacade(mockedWebClient,
getConfiguration());

Expand Down
55 changes: 47 additions & 8 deletions knotx-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
<artifactId>knotx-core</artifactId>

<name>Knot.x Core</name>
<description>Core Knot.x module consisting of Server, Repositories, Splitter, Assembler and Gateway.</description>
<description>Core Knot.x module consisting of Server, Repositories, Splitter, Assembler and
Gateway.
</description>

<dependencies>
<dependency>
Expand Down Expand Up @@ -113,14 +115,55 @@
</dependency>

<!-- Tests -->
<dependency>
<groupId>io.knotx</groupId>
<artifactId>knotx-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<artifactId>vertx-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-migrationsupport</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>

<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
Expand All @@ -138,10 +181,6 @@
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
import org.apache.commons.lang3.StringUtils;

/**
* Describes SnippetOptions Knot configuration
Expand Down Expand Up @@ -106,7 +107,7 @@ public String getParamsPrefix() {
* @return a reference to this, so the API can be used fluently
*/
public SnippetOptions setParamsPrefix(String paramsPrefix) {
this.paramsPrefix = paramsPrefix;
this.paramsPrefix = paramsPrefix == null ? StringUtils.EMPTY : paramsPrefix;
return this;
}
}
Loading