@Test public void testGetSystemExceptionShouldReturnWithNullWhenExceptionMostSpecificCauseIsNull() { // GIVEN given(beanCreationException.getMostSpecificCause()).willReturn(null); // WHEN SystemException actual = underTest.getSystemException(beanCreationException); // THEN assertNull(actual); }
@Test public void testGetSystemExceptionShouldReturnWithSystemExceptionWhenExceptionCauseContainsSystemException() { // GIVEN given(beanCreationException.getMostSpecificCause()).willReturn(invalidPropertyException); given(beanCreationException.getCause()) .willReturn(invalidPropertyException, invalidPropertyException); // WHEN SystemException actual = underTest.getSystemException(beanCreationException); // THEN assertNotNull(actual); }