Skip to content

Commit 904a0d7

Browse files
committed
cleanup
1 parent 000f50e commit 904a0d7

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

.github/workflows/test.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# FILEPATH: /Users/saf/dev/pact-foundation/pact-workshop-jvm-spring/.github/workflows/test.yml
2-
31
name: CI
42
on:
53
push:
64
branches:
75
- main
8-
- dep_update
96
pull_request:
107
branches:
118
- main
@@ -15,10 +12,10 @@ jobs:
1512

1613
steps:
1714
- name: Checkout code
18-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1916

2017
- name: Set up JDK 17
21-
uses: actions/setup-java@v2
18+
uses: actions/setup-java@v4
2219
with:
2320
java-version: 17
2421
distribution: 'temurin'

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ In `consumer/src/test/java/au/com/dius/pactworkshop/consumer/ProductConsumerPact
545545

546546
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
547547
() -> new ProductService(restTemplate).getProduct("11"));
548-
assertEquals(404, e.getRawStatusCode());
548+
assertEquals(404, e.getStatusCode().value());
549549
}
550550
```
551551

@@ -818,7 +818,7 @@ public class ProductConsumerPactTest {
818818

819819
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
820820
() -> new ProductService(restTemplate).getAllProducts());
821-
assertEquals(401, e.getRawStatusCode());
821+
assertEquals(401, e.getStatusCode().value());
822822
}
823823

824824
@Test
@@ -846,7 +846,7 @@ public class ProductConsumerPactTest {
846846

847847
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
848848
() -> new ProductService(restTemplate).getProduct("11"));
849-
assertEquals(404, e.getRawStatusCode());
849+
assertEquals(404, e.getStatusCode().value());
850850
}
851851

852852
@Test
@@ -858,7 +858,7 @@ public class ProductConsumerPactTest {
858858

859859
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
860860
() -> new ProductService(restTemplate).getProduct("10"));
861-
assertEquals(401, e.getRawStatusCode());
861+
assertEquals(401, e.getStatusCode().value());
862862
}
863863

864864
private Map<String, String> headers() {
@@ -1096,7 +1096,8 @@ Now run
10961096
./gradlew consumer:test --tests '*PactTest*' pactPublish
10971097
10981098
> Task :consumer:pactPublish
1099-
Publishing 'FrontendApplication-ProductService.json' with tags step11, test, prod ... OK
1099+
Publishing 'FrontendApplication-ProductService.json'
1100+
OK
11001101
11011102
BUILD SUCCESSFUL in 11s
11021103

consumer/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ dependencies {
2929
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
3030
}
3131
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
32-
// testImplementation 'au.com.dius.pact.consumer:java8:4.6.5'
3332
testImplementation 'au.com.dius.pact.consumer:junit5:4.6.5'
3433
}
3534

consumer/src/test/java/au/com/dius/pactworkshop/consumer/ProductConsumerPactTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void getAllProducts_whenNoAuth(MockServer mockServer) {
149149

150150
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
151151
() -> new ProductService(restTemplate).getAllProducts());
152-
assertEquals(401, e.getRawStatusCode());
152+
assertEquals(401, e.getStatusCode().value());
153153
}
154154

155155
@Test
@@ -177,7 +177,7 @@ void getProductById_whenProductWithId11DoesNotExist(MockServer mockServer) {
177177

178178
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
179179
() -> new ProductService(restTemplate).getProduct("11"));
180-
assertEquals(404, e.getRawStatusCode());
180+
assertEquals(404, e.getStatusCode().value());
181181
}
182182

183183
@Test
@@ -189,7 +189,7 @@ void getProductById_whenNoAuth(MockServer mockServer) {
189189

190190
HttpClientErrorException e = assertThrows(HttpClientErrorException.class,
191191
() -> new ProductService(restTemplate).getProduct("10"));
192-
assertEquals(401, e.getRawStatusCode());
192+
assertEquals(401, e.getStatusCode().value());
193193
}
194194

195195
private Map<String, String> headers() {

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

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import au.com.dius.pact.provider.junitsupport.loader.PactBroker;
99
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerAuth;
1010
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder;
11-
// import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
1211
import org.apache.hc.core5.http.HttpRequest;
1312
import org.junit.jupiter.api.BeforeEach;
1413
import org.junit.jupiter.api.TestTemplate;
@@ -22,13 +21,11 @@
2221
import java.util.Arrays;
2322
import java.util.Collections;
2423
import java.util.Date;
25-
import java.util.List;
2624
import java.util.Optional;
2725

2826
import static org.mockito.Mockito.when;
2927

3028
@Provider("ProductService")
31-
//@PactFolder("pacts")
3229
@PactBroker(
3330
host = "localhost",
3431
port = "8000",
@@ -40,11 +37,12 @@
4037
public class ProductPactProviderTest {
4138
@au.com.dius.pact.provider.junitsupport.loader.PactBrokerConsumerVersionSelectors
4239
public static SelectorBuilder consumerVersionSelectors() {
43-
// Select Pacts for consumers deployed to production with branch from CI build
40+
// Select Pacts for consumers deployed or released to production, those on the main branch
41+
// and those on a named branch step11, for use in our workshop
4442
return new SelectorBuilder()
4543
.deployedOrReleased()
4644
.mainBranch()
47-
.branch("dep_update");
45+
.branch("step11");
4846
}
4947
@LocalServerPort
5048
int port;

0 commit comments

Comments
 (0)