All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Download junit - 4.12)),) JAR files with dependency

Search JAR files by class name

archunit-junit5-engine-api from group com.tngtech.archunit (version 0.14.1)

A Java architecture test library, to specify and assert architecture rules in plain Java - Module 'archunit-junit5-engine-api'

Group: com.tngtech.archunit Artifact: archunit-junit5-engine-api
Show all versions Show documentation Show source 
 

2 downloads
Artifact archunit-junit5-engine-api
Group com.tngtech.archunit
Version 0.14.1
Last update 23. May 2020
Newest version Yes
Organization TNG Technology Consulting GmbH
URL https://github.com/TNG/ArchUnit
License The Apache Software License, Version 2.0
Dependencies amount 1
Dependencies junit-platform-engine,
There are maybe transitive dependencies!

archunit-junit5-engine from group com.tngtech.archunit (version 0.14.1)

A Java architecture test library, to specify and assert architecture rules in plain Java - Module 'archunit-junit5-engine'

Group: com.tngtech.archunit Artifact: archunit-junit5-engine
Show all versions Show documentation Show source 
 

0 downloads
Artifact archunit-junit5-engine
Group com.tngtech.archunit
Version 0.14.1
Last update 23. May 2020
Newest version Yes
Organization TNG Technology Consulting GmbH
URL https://github.com/TNG/ArchUnit
License The Apache Software License, Version 2.0
Dependencies amount 3
Dependencies archunit, archunit-junit5-api, archunit-junit5-engine-api,
There are maybe transitive dependencies!

archunit-junit5-api from group com.tngtech.archunit (version 0.14.1)

A Java architecture test library, to specify and assert architecture rules in plain Java - Module 'archunit-junit5-api'

Group: com.tngtech.archunit Artifact: archunit-junit5-api
Show all versions Show documentation Show source 
 

0 downloads
Artifact archunit-junit5-api
Group com.tngtech.archunit
Version 0.14.1
Last update 23. May 2020
Newest version Yes
Organization TNG Technology Consulting GmbH
URL https://github.com/TNG/ArchUnit
License The Apache Software License, Version 2.0
Dependencies amount 1
Dependencies archunit,
There are maybe transitive dependencies!

archunit-junit5 from group com.tngtech.archunit (version 0.14.1)

A Java architecture test library, to specify and assert architecture rules in plain Java - Module 'archunit-junit5'

Group: com.tngtech.archunit Artifact: archunit-junit5
Show all versions Show documentation Show source 
 

0 downloads
Artifact archunit-junit5
Group com.tngtech.archunit
Version 0.14.1
Last update 23. May 2020
Newest version Yes
Organization TNG Technology Consulting GmbH
URL https://github.com/TNG/ArchUnit
License The Apache Software License, Version 2.0
Dependencies amount 1
Dependencies archunit-junit5-api,
There are maybe transitive dependencies!

archunit-junit4 from group com.tngtech.archunit (version 0.14.1)

A Java architecture test library, to specify and assert architecture rules in plain Java - Module 'archunit-junit4'

Group: com.tngtech.archunit Artifact: archunit-junit4
Show all versions Show documentation Show source 
 

1 downloads
Artifact archunit-junit4
Group com.tngtech.archunit
Version 0.14.1
Last update 23. May 2020
Newest version Yes
Organization TNG Technology Consulting GmbH
URL https://github.com/TNG/ArchUnit
License The Apache Software License, Version 2.0
Dependencies amount 2
Dependencies archunit, junit,
There are maybe transitive dependencies!

junit5spring from group au.com.dius.pact.provider (version 4.1.7)

# Pact Spring/JUnit5 Support This module extends the base [Pact JUnit5 module](../junit5). See that for more details. For writing Spring Pact verification tests with JUnit 5, there is an JUnit 5 Invocation Context Provider that you can use with the `@TestTemplate` annotation. This will generate a test for each interaction found for the pact files for the provider. To use it, add the `@Provider` and `@ExtendWith(SpringExtension.class)` and one of the pact source annotations to your test class (as per a JUnit 5 test), then add a method annotated with `@TestTemplate` and `@ExtendWith(PactVerificationSpringProvider.class)` that takes a `PactVerificationContext` parameter. You will need to call `verifyInteraction()` on the context parameter in your test template method. For example: ```java @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) @Provider("Animal Profile Service") @PactBroker public class ContractVerificationTest { @TestTemplate @ExtendWith(PactVerificationSpringProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); } } ``` You will now be able to setup all the required properties using the Spring context, e.g. creating an application YAML file in the test resources: ```yaml pactbroker: host: your.broker.host auth: username: broker-user password: broker.password ``` You can also run pact tests against `MockMvc` without need to spin up the whole application context which takes time and often requires more additional setup (e.g. database). In order to run lightweight tests just use `@WebMvcTest` from Spring and `MockMvcTestTarget` as a test target before each test. For example: ```java @WebMvcTest @Provider("myAwesomeService") @PactBroker class ContractVerificationTest { @Autowired private MockMvc mockMvc; @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); } @BeforeEach void before(PactVerificationContext context) { context.setTarget(new MockMvcTestTarget(mockMvc)); } } ``` You can also use `MockMvcTestTarget` for tests without spring context by providing the controllers manually. For example: ```java @Provider("myAwesomeService") @PactFolder("pacts") class MockMvcTestTargetStandaloneMockMvcTestJava { @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); } @BeforeEach void before(PactVerificationContext context) { MockMvcTestTarget testTarget = new MockMvcTestTarget(); testTarget.setControllers(new DataResource()); context.setTarget(testTarget); } @RestController static class DataResource { @GetMapping("/data") @ResponseStatus(HttpStatus.NO_CONTENT) void getData(@RequestParam("ticketId") String ticketId) { } } } ``` **Important:** Since `@WebMvcTest` starts only Spring MVC components you can't use `PactVerificationSpringProvider` and need to fallback to `PactVerificationInvocationContextProvider`

Group: au.com.dius.pact.provider Artifact: junit5spring
Show all versions Show documentation Show source 
 

0 downloads
Artifact junit5spring
Group au.com.dius.pact.provider
Version 4.1.7
Last update 09. August 2020
Newest version Yes
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 0
Dependencies No dependencies
There are maybe transitive dependencies!

junit5 from group au.com.dius.pact.provider (version 4.1.7)

# Pact Junit 5 Extension ## Overview For writing Pact verification tests with JUnit 5, there is an JUnit 5 Invocation Context Provider that you can use with the `@TestTemplate` annotation. This will generate a test for each interaction found for the pact files for the provider. To use it, add the `@Provider` and one of the pact source annotations to your test class (as per a JUnit 4 test), then add a method annotated with `@TestTemplate` and `@ExtendWith(PactVerificationInvocationContextProvider.class)` that takes a `PactVerificationContext` parameter. You will need to call `verifyInteraction()` on the context parameter in your test template method. For example: ```java @Provider("myAwesomeService") @PactFolder("pacts") public class ContractVerificationTest { @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void pactVerificationTestTemplate(PactVerificationContext context) { context.verifyInteraction(); } } ``` For details on the provider and pact source annotations, refer to the [Pact junit runner](../junit/) docs. ## Test target You can set the test target (the object that defines the target of the test, which should point to your provider) on the `PactVerificationContext`, but you need to do this in a before test method (annotated with `@BeforeEach`). There are three different test targets you can use: `HttpTestTarget`, `HttpsTestTarget` and `MessageTestTarget`. For example: ```java @BeforeEach void before(PactVerificationContext context) { context.setTarget(HttpTestTarget.fromUrl(new URL(myProviderUrl))); // or something like // context.setTarget(new HttpTestTarget("localhost", myProviderPort, "/")); } ``` **Note for Maven users:** If you use Maven to run your tests, you will have to make sure that the Maven Surefire plugin is at least version 2.22.1 uses an isolated classpath. For example, configure it by adding the following to your POM: ```xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> <configuration> <useSystemClassLoader>false</useSystemClassLoader> </configuration> </plugin> ``` ## Provider State Methods Provider State Methods work in the same way as with JUnit 4 tests, refer to the [Pact junit runner](../junit/) docs. ### Using multiple classes for the state change methods If you have a large number of state change methods, you can split things up by moving them to other classes. You will need to specify the additional classes on the test context in a `Before` method. Do this with the `withStateHandler` or `setStateHandlers` methods. See [StateAnnotationsOnAdditionalClassTest](src/test/java/au/com/dius/pact/provider/junit5/StateAnnotationsOnAdditionalClassTest.java) for an example. ## Modifying the requests before they are sent **Important Note:** You should only use this feature for things that can not be persisted in the pact file. By modifying the request, you are potentially modifying the contract from the consumer tests! **NOTE: JUnit 5 tests do not use `@TargetRequestFilter`** Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The Http and Https test targets support injecting the request that will executed into the test template method. You can then add things to the request before calling the `verifyInteraction()` method. For example to add a header: ```java @TestTemplate @ExtendWith(PactVerificationInvocationContextProvider.class) void testTemplate(PactVerificationContext context, HttpRequest request) { // This will add a header to the request request.addHeader("X-Auth-Token", "1234"); context.verifyInteraction(); } ``` ## Objects that can be injected into the test methods You can inject the following objects into your test methods (just like the `PactVerificationContext`). They will be null if injected before the supported phase. | Object | Can be injected from phase | Description | | ------ | --------------- | ----------- | | PactVerificationContext | @BeforeEach | The context to use to execute the interaction test | | Pact | any | The Pact model for the test | | Interaction | any | The Interaction model for the test | | HttpRequest | @TestTemplate | The request that is going to be executed (only for HTTP and HTTPS targets) | | ProviderVerifier | @TestTemplate | The verifier instance that is used to verify the interaction | ## Allowing the test to pass when no pacts are found to verify (version 4.0.7+) By default, the test will fail with an exception if no pacts were found to verify. This can be overridden by adding the `@IgnoreNoPactsToVerify` annotation to the test class. For this to work, you test class will need to be able to receive null values for any of the injected parameters. ## Overriding the handling of a body data type **NOTE: version 4.1.3+** By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64 encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting `pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them. # Pending Pact Support (version 4.1.0 and later) If your Pact broker supports pending pacts, you can enable support for that by enabling that on your Pact broker annotation or with JVM system properties. You also need to provide the tags that will be published with your provider's verification results. The broker will then label any pacts found that don't have a successful verification result as pending. That way, if they fail verification, the verifier will ignore those failures and not fail the build. For example, with annotation: ```java @Provider("Activity Service") @PactBroker(host = "test.pactflow.io", tags = {"test"}, scheme = "https", enablePendingPacts = "true", providerTags = "master" ) public class PactJUnitTest { ``` You can also use the `pactbroker.enablePending` and `pactbroker.providerTags` JVM system properties. Then any pending pacts will not cause a build failure. # Work In Progress (WIP) Pact Support (version 4.1.5 and later) WIP pacts work in the same way as with JUnit 4 tests, refer to the [Pact junit runner](../junit/) docs.

Group: au.com.dius.pact.provider Artifact: junit5
Show all versions Show documentation Show source 
 

0 downloads
Artifact junit5
Group au.com.dius.pact.provider
Version 4.1.7
Last update 09. August 2020
Newest version Yes
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 3
Dependencies junit-jupiter-api, support, provider,
There are maybe transitive dependencies!

junit5 from group au.com.dius.pact.consumer (version 4.1.7)

pact-jvm-consumer-junit5 ======================== JUnit 5 support for Pact consumer tests ## Dependency The library is available on maven central using: * group-id = `au.com.dius.pact.consumer` * artifact-id = `junit5` * version-id = `4.1.0` ## Usage ### 1. Add the Pact consumer test extension to the test class. To write Pact consumer tests with JUnit 5, you need to add `@ExtendWith(PactConsumerTestExt)` to your test class. This replaces the `PactRunner` used for JUnit 4 tests. The rest of the test follows a similar pattern as for JUnit 4 tests. ```java @ExtendWith(PactConsumerTestExt.class) class ExampleJavaConsumerPactTest { ``` ### 2. create a method annotated with `@Pact` that returns the interactions for the test For each test (as with JUnit 4), you need to define a method annotated with the `@Pact` annotation that returns the interactions for the test. ```java @Pact(provider="ArticlesProvider", consumer="test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { return builder .given("test state") .uponReceiving("ExampleJavaConsumerPactTest test interaction") .path("/articles.json") .method("GET") .willRespondWith() .status(200) .body("{\"responsetest\": true}") .toPact(); } ``` ### 3. Link the mock server with the interactions for the test with `@PactTestFor` Then the final step is to use the `@PactTestFor` annotation to tell the Pact extension how to setup the Pact test. You can either put this annotation on the test class, or on the test method. For examples see [ArticlesTest](src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) and [MultiTest](src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy). The `@PactTestFor` annotation allows you to control the mock server in the same way as the JUnit 4 `PactProviderRule`. It allows you to set the hostname to bind to (default is `localhost`) and the port (default is to use a random port). You can also set the Pact specification version to use (default is V3). ```java @ExtendWith(PactConsumerTestExt.class) @PactTestFor(providerName = "ArticlesProvider") public class ExampleJavaConsumerPactTest { ``` **NOTE on the hostname**: The mock server runs in the same JVM as the test, so the only valid values for hostname are: | hostname | result | | -------- | ------ | | `localhost` | binds to the address that localhost points to (normally the loopback adapter) | | `127.0.0.1` or `::1` | binds to the loopback adapter | | host name | binds to the default interface that the host machines DNS name resolves to | | `0.0.0.0` or `::` | binds to the all interfaces on the host machine | #### Matching the interactions by provider name If you set the `providerName` on the `@PactTestFor` annotation, then the first method with a `@Pact` annotation with the same provider name will be used. See [ArticlesTest](src/test/java/au/com/dius/pact/consumer/junit5/ArticlesTest.java) for an example. #### Matching the interactions by method name If you set the `pactMethod` on the `@PactTestFor` annotation, then the method with the provided name will be used (it still needs a `@Pact` annotation). See [MultiTest](src/test/groovy/au/com/dius/pact/consumer/junit5/MultiTest.groovy) for an example. ### Injecting the mock server into the test You can get the mock server injected into the test method by adding a `MockServer` parameter to the test method. ```java @Test void test(MockServer mockServer) throws IOException { HttpResponse httpResponse = Request.Get(mockServer.getUrl() + "/articles.json").execute().returnResponse(); assertThat(httpResponse.getStatusLine().getStatusCode(), is(equalTo(200))); } ``` This helps with getting the base URL of the mock server, especially when a random port is used. ## Changing the directory pact files are written to By default, pact files are written to `target/pacts` (or `build/pacts` if you use Gradle), but this can be overwritten with the `pact.rootDir` system property. This property needs to be set on the test JVM as most build tools will fork a new JVM to run the tests. For Gradle, add this to your build.gradle: ```groovy test { systemProperties['pact.rootDir'] = "$buildDir/custom-pacts-directory" } ``` For maven, use the systemPropertyVariables configuration: ```xml <project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18</version> <configuration> <systemPropertyVariables> <pact.rootDir>some/other/directory</pact.rootDir> <buildDirectory>${project.build.directory}</buildDirectory> [...] </systemPropertyVariables> </configuration> </plugin> </plugins> </build> [...] </project> ``` For SBT: ```scala fork in Test := true, javaOptions in Test := Seq("-Dpact.rootDir=some/other/directory") ``` ### Using `@PactFolder` annotation You can override the directory the pacts are written in a test by adding the `@PactFolder` annotation to the test class. ## Forcing pact files to be overwritten By default, when the pact file is written, it will be merged with any existing pact file. To force the file to be overwritten, set the Java system property `pact.writer.overwrite` to `true`. ## Unsupported The current implementation does not support tests with multiple providers. This will be added in a later release. # Having values injected from provider state callbacks You can have values from the provider state callbacks be injected into most places (paths, query parameters, headers, bodies, etc.). This works by using the V3 spec generators with provider state callbacks that return values. One example of where this would be useful is API calls that require an ID which would be auto-generated by the database on the provider side, so there is no way to know what the ID would be beforehand. The following DSL methods all you to set an expression that will be parsed with the values returned from the provider states: For JSON bodies, use `valueFromProviderState`.<br/> For headers, use `headerFromProviderState`.<br/> For query parameters, use `queryParameterFromProviderState`.<br/> For paths, use `pathFromProviderState`. For example, assume that an API call is made to get the details of a user by ID. A provider state can be defined that specifies that the user must be exist, but the ID will be created when the user is created. So we can then define an expression for the path where the ID will be replaced with the value returned from the provider state callback. ```java .pathFromProviderState("/api/users/${id}", "/api/users/100") ``` You can also just use the key instead of an expression: ```java .valueFromProviderState('userId', 'userId', 100) // will look value using userId as the key ``` ## Using HTTPS You can enable a HTTPS mock server by setting `https=true` on the `@PactTestFor` annotation. Note that this mock server will use a self-signed certificate, so any client code will need to accept self-signed certificates.

Group: au.com.dius.pact.consumer Artifact: junit5
Show all versions Show documentation Show source 
 

0 downloads
Artifact junit5
Group au.com.dius.pact.consumer
Version 4.1.7
Last update 09. August 2020
Newest version Yes
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 2
Dependencies junit-jupiter-api, consumer,
There are maybe transitive dependencies!

recursive-assertion-junit5 from group com.github.vladislavsevruk (version 1.0.0)

This utility library helps to assert complex models using various settings and provide convenient error messages using JUnit 5 AssertAll mechanism.

Group: com.github.vladislavsevruk Artifact: recursive-assertion-junit5
Show documentation Show source 
 

0 downloads
Artifact recursive-assertion-junit5
Group com.github.vladislavsevruk
Version 1.0.0
Last update 30. July 2020
Newest version Yes
Organization not specified
URL https://github.com/VladislavSevruk/RecursiveAssertion/recursive-assertion-junit5
License MIT License
Dependencies amount 2
Dependencies recursive-assertion-core, junit-jupiter-api,
There are maybe transitive dependencies!

stubr-junit from group ch.leadrian.stubr (version 2.0.1)

Library for instantiating stub objects in unit tests

Group: ch.leadrian.stubr Artifact: stubr-junit
Show all versions Show documentation Show source 
 

0 downloads
Artifact stubr-junit
Group ch.leadrian.stubr
Version 2.0.1
Last update 04. July 2020
Newest version Yes
Organization not specified
URL https://github.com/Double-O-Seven/stubr
License The Apache License, Version 2.0
Dependencies amount 2
Dependencies stubr-core, junit-jupiter-api,
There are maybe transitive dependencies!



Page 135 from 137 (items total 1363)


© 2018 Weber Informatics LLC