Skip to content

Commit 3df4af9

Browse files
committed
fix: Contract Tests
1 parent 99bedc6 commit 3df4af9

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

customer-client/test/create-customer.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
* limitations under the License.
1515
*/
1616
import { test, expect } from '@playwright/test';
17+
import { MatchersV3 } from '@pact-foundation/pact';
1718
import { createProvider, setupApiProxy } from './pact-proxy';
18-
import { PactV4 } from '@pact-foundation/pact';
19-
import path from 'path';
2019

2120
test.describe('Neuer Kunde', () => {
2221
test('zeigt Fehler bei leerem Namen', async ({ page }) => {
@@ -44,7 +43,7 @@ test.describe('Neuer Kunde', () => {
4443
})
4544
.willRespondWith(201, (builder) => {
4645
builder.headers({
47-
"Location": "http://localhost:50376/customers/1"
46+
"Location": MatchersV3.regex('http://localhost/customers/\\d+', 'http://localhost/customers/1')
4847
})
4948
});
5049

@@ -58,7 +57,7 @@ test.describe('Neuer Kunde', () => {
5857
{ number: '007', name: 'James Bond' },
5958
{ number: '0815', name: 'Max Mustermann' },
6059
{ number: '0816', name: 'Erika Mustermann' },
61-
{ number: '1', name: 'Sherlock Holmes' },
60+
{ number: MatchersV3.like('1'), name: 'Sherlock Holmes' },
6261
]);
6362
})
6463
.executeTest(async (mockServer) => {

customer-service/src/test/java/de/openknowledge/sample/customer/domain/TestCustomerRepository.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@
1515
*/
1616
package de.openknowledge.sample.customer.domain;
1717

18-
import jakarta.enterprise.context.Destroyed;
1918
import jakarta.enterprise.context.RequestScoped;
20-
import jakarta.enterprise.event.Observes;
2119
import jakarta.enterprise.inject.Specializes;
2220

2321
@Specializes
22+
@RequestScoped
2423
public class TestCustomerRepository extends CustomerRepository {
25-
26-
public void reset(@Observes @Destroyed(RequestScoped.class) Object event) {
27-
super.initialize();
28-
}
2924
}

0 commit comments

Comments
 (0)