CustomerDTO: AccessFor/Rights-Configuration
This commit is contained in:
parent
63bd602397
commit
d2b0f477f2
@ -31,8 +31,8 @@ public class CustomerDTOUnitTest {
|
|||||||
public void testSerializationAsContractualCustomerContact() throws JsonProcessingException {
|
public void testSerializationAsContractualCustomerContact() throws JsonProcessingException {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
CustomerDTO given = createSomeCustomerDTO();
|
|
||||||
givenLoginUserWithRole(Role.ANY_CUSTOMER_USER);
|
givenLoginUserWithRole(Role.ANY_CUSTOMER_USER);
|
||||||
|
CustomerDTO given = createSomeCustomerDTO();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
String actual = objectMapper.writeValueAsString(given);
|
String actual = objectMapper.writeValueAsString(given);
|
||||||
@ -50,8 +50,8 @@ public class CustomerDTOUnitTest {
|
|||||||
public void testSerializationAsSupporter() throws JsonProcessingException {
|
public void testSerializationAsSupporter() throws JsonProcessingException {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
CustomerDTO given = createSomeCustomerDTO();
|
|
||||||
givenLoginUserWithRole(Role.SUPPORTER);
|
givenLoginUserWithRole(Role.SUPPORTER);
|
||||||
|
CustomerDTO given = createSomeCustomerDTO();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
String actual = objectMapper.writeValueAsString(given);
|
String actual = objectMapper.writeValueAsString(given);
|
||||||
@ -63,8 +63,8 @@ public class CustomerDTOUnitTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testDeserializeAsContractualCustomerContact() throws IOException {
|
public void testDeserializeAsContractualCustomerContact() throws IOException {
|
||||||
// given
|
// given
|
||||||
String json = "{\"id\":1234,\"reference\":10001,\"prefix\":\"abc\",\"name\":\"Mein Name\",\"contractualAddress\":\"Eine Adresse\",\"contractualSalutation\":\"Hallo\",\"billingAddress\":\"Noch eine Adresse\",\"billingSalutation\":\"Moin\",\"remark\":\"Eine Bemerkung\"}";
|
|
||||||
givenLoginUserWithRole(Role.CONTRACTUAL_CONTACT);
|
givenLoginUserWithRole(Role.CONTRACTUAL_CONTACT);
|
||||||
|
String json = "{\"id\":1234,\"contractualSalutation\":\"Hallo Updated\",\"billingSalutation\":\"Moin Updated\"}";
|
||||||
|
|
||||||
// when
|
// when
|
||||||
CustomerDTO actual = objectMapper.readValue(json, CustomerDTO.class);
|
CustomerDTO actual = objectMapper.readValue(json, CustomerDTO.class);
|
||||||
@ -72,15 +72,9 @@ public class CustomerDTOUnitTest {
|
|||||||
// then
|
// then
|
||||||
CustomerDTO expected = new CustomerDTO();
|
CustomerDTO expected = new CustomerDTO();
|
||||||
expected.setId(1234L);
|
expected.setId(1234L);
|
||||||
expected.setReference(10001);
|
expected.setContractualSalutation("Hallo Updated");
|
||||||
expected.setPrefix("abc");
|
expected.setBillingSalutation("Moin Updated");
|
||||||
expected.setName("Mein Name");
|
assertThat(actual).isEqualToComparingFieldByField(expected);
|
||||||
expected.setContractualAddress(null); // not allowed
|
|
||||||
expected.setContractualSalutation("Hallo");
|
|
||||||
expected.setBillingAddress("Noch eine Adresse");
|
|
||||||
expected.setBillingSalutation("Moin");
|
|
||||||
expected.setRemark("Eine Bemerkung");
|
|
||||||
assertEquals(actual, expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createExpectedJSon(CustomerDTO dto) {
|
private String createExpectedJSon(CustomerDTO dto) {
|
||||||
|
Loading…
Reference in New Issue
Block a user