Skip to content

Commit 4dc48b6

Browse files
author
Ronald Holshausen
committed
chore: update readme + JDK 8 fix
1 parent edd9f9f commit 4dc48b6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ We expected this failure, because the product we are requesting does in fact exi
591591

592592
We could resolve this by updating our consumer test to use a known non-existent product, but it's worth understanding how Provider states work more generally.
593593

594-
Move on to [step 7](https://github.com/pact-foundation/pact-workshop-jvm-spring/tree/step7#step-7---adding-the-missing-states)
594+
Move on to [step 7](https://github.com/pact-foundation/pact-workshop-jvm-spring/tree/step7#step-7---adding-the-missing-states)
595595

596596
## Step 7 - Adding the missing states
597597

@@ -613,9 +613,9 @@ Let's open up our provider Pact verifications in `provider/src/test/java/au/com/
613613
```java
614614
@State("products exist")
615615
void toProductsExistState() {
616-
when(productRepository.fetchAll()).thenReturn(
617-
List.of(new Product("09", "CREDIT_CARD", "Gem Visa", "v1"),
618-
new Product("10", "CREDIT_CARD", "28 Degrees", "v1")));
616+
when(productRepository.fetchAll()).thenReturn(
617+
Arrays.asList(new Product("09", "CREDIT_CARD", "Gem Visa", "v1"),
618+
new Product("10", "CREDIT_CARD", "28 Degrees", "v1")));
619619
}
620620

621621
@State({
@@ -642,6 +642,8 @@ BUILD SUCCESSFUL in 11s
642642

643643
_NOTE_: The states are not necessarily a 1 to 1 mapping with the consumer contract tests. You can reuse states amongst different tests. In this scenario we could have used `no products exist` for both tests which would have equally been valid.
644644

645+
Move on to [step 8](https://github.com/pact-foundation/pact-workshop-jvm-spring/tree/step8#step-8---authorization)
646+
645647
## Step 8 - Authorization
646648

647649
It turns out that not everyone should be able to use the API. After a discussion with the team, it was decided that a time-bound bearer token would suffice. The token must be in `yyyy-MM-ddTHHmm` format and within 1 hour of the current time.

provider/src/test/java/au/com/dius/pactworkshop/provider/ProductPactProviderTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import org.springframework.boot.web.server.LocalServerPort;
1515
import org.springframework.test.context.junit.jupiter.SpringExtension;
1616

17+
import java.util.Arrays;
1718
import java.util.Collections;
18-
import java.util.List;
1919
import java.util.Optional;
2020

2121
import static org.mockito.Mockito.when;
@@ -46,7 +46,7 @@ void verifyPact(PactVerificationContext context) {
4646
@State("products exist")
4747
void toProductsExistState() {
4848
when(productRepository.fetchAll()).thenReturn(
49-
List.of(new Product("09", "CREDIT_CARD", "Gem Visa", "v1"),
49+
Arrays.asList(new Product("09", "CREDIT_CARD", "Gem Visa", "v1"),
5050
new Product("10", "CREDIT_CARD", "28 Degrees", "v1")));
5151
}
5252

0 commit comments

Comments
 (0)