-
Notifications
You must be signed in to change notification settings - Fork 102
/
ContractTest.java
28 lines (21 loc) · 994 Bytes
/
ContractTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.example;
import java.io.IOException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
public class ContractTest extends BaseJsonSchemaValidatorTest {
@Test
public void testAddressHasFourFields() throws IOException{
JsonNode jsonNode = getJsonNodeFromClasspath("events/customerCreated-event-1.1.0.json");
CustomerValidator validator = new CustomerValidator();
// Check for business logic in address validation
Assertions.assertTrue(validator.isValidAddress(jsonNode));
}
@Test
public void testAddressHasThreeFieldsOrLess() throws IOException{
JsonNode jsonNode = getJsonNodeFromClasspath("events/customerCreated-event-1.4.0.json");
CustomerValidator validator = new CustomerValidator();
// Check for business logic in address validation
Assertions.assertFalse(validator.isValidAddress(jsonNode));
}
}