Add factory method to unwrap a PdxInstanceWrapper returning the underlying, delegate PdxInstance.

This commit is contained in:
John Blum
2020-06-10 01:49:31 -07:00
parent e8a8486f33
commit 139d52918c
2 changed files with 48 additions and 0 deletions

View File

@@ -117,6 +117,35 @@ public class PdxInstanceWrapperUnitTests {
verifyNoInteractions(mockPdxInstance);
}
@Test
public void unwrapPdxInstanceWrapperReturnsPdxInstanceDelegate() {
PdxInstance mockPdxInstance = mock(PdxInstance.class);
PdxInstanceWrapper wrapper = PdxInstanceWrapper.from(mockPdxInstance);
assertThat(wrapper).isNotNull();
assertThat(wrapper.getDelegate()).isEqualTo(mockPdxInstance);
assertThat(PdxInstanceWrapper.unwrap(wrapper)).isEqualTo(mockPdxInstance);
verifyNoInteractions(mockPdxInstance);
}
@Test
public void unwrapPdxInstanceReturnsPdxInstance() {
PdxInstance mockPdxInstance = mock(PdxInstance.class);
assertThat(PdxInstanceWrapper.unwrap(mockPdxInstance)).isEqualTo(mockPdxInstance);
verifyNoInteractions(mockPdxInstance);
}
@Test
public void unwrapNullIsNullSafeAndReturnsNull() {
assertThat(PdxInstanceWrapper.unwrap(null)).isNull();
}
@Test
public void objectMapperConfigurationIsCorrect() {