1
0

JSonDeserializerWithAccessFilter: shouldDetectMultipleSelfIdFields

This commit is contained in:
Michael Hoennig
2019-04-23 09:22:23 +02:00
parent d2b0f477f2
commit 1505e7bd66
3 changed files with 34 additions and 29 deletions

View File

@@ -127,15 +127,15 @@ public class JSonDeserializerWithAccessFilterUnitTest {
}
@Test
public void should() throws IOException {
public void shouldDetectMultipleSelfIdFields() throws IOException {
// given
givenJSonTree(asJSon(ImmutablePair.of("restrictedField", "Restricted String Value")));
givenJSonTree(asJSon(ImmutablePair.of("id", 1111L)));
// when
Throwable exception = catchThrowable(() -> new JSonDeserializerWithAccessFilter<>(jsonParser, null, GivenDtoWithMultipleSelfId.class).deserialize());
// then
assertThat(exception).isInstanceOf(AssertionError.class).hasMessageContaining("xx");
assertThat(exception).isInstanceOf(AssertionError.class).hasMessage("multiple @SelfId detected in GivenDtoWithMultipleSelfId");
}
// --- only fixture code below ---
@@ -183,7 +183,6 @@ public class JSonDeserializerWithAccessFilterUnitTest {
Long openLongField;
}
public static class GivenDtoWithMultipleSelfId {
@SelfId