Search in sources :

Example 1 with SakuliValidationException

use of org.sakuli.exceptions.SakuliValidationException in project sakuli by ConSol.

the class TestCaseActionTest method testThrowExceptionWithScreenshot.

@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Test
public void testThrowExceptionWithScreenshot() throws Exception {
    String exMessage = "TEST";
    testling.throwException(exMessage, true);
    ArgumentCaptor<Throwable> ac = ArgumentCaptor.forClass(Throwable.class);
    verify(exceptionHandlerMock).handleException(ac.capture());
    assertEquals(ac.getValue().getMessage(), exMessage);
    assertFalse(ac.getValue() instanceof SakuliValidationException);
    assertFalse(ac.getValue() instanceof NonScreenshotException);
    assertTrue(ac.getValue() instanceof SakuliActionException);
}
Also used : NonScreenshotException(org.sakuli.exceptions.NonScreenshotException) SakuliValidationException(org.sakuli.exceptions.SakuliValidationException) Matchers.anyString(org.mockito.Matchers.anyString) SakuliActionException(org.sakuli.exceptions.SakuliActionException) Test(org.testng.annotations.Test) BaseTest(org.sakuli.BaseTest)

Example 2 with SakuliValidationException

use of org.sakuli.exceptions.SakuliValidationException in project sakuli by ConSol.

the class TestCaseActionTest method testThrowExceptionNoScreenshot.

@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Test
public void testThrowExceptionNoScreenshot() throws Exception {
    String exMessage = "TEST";
    testling.throwException(exMessage, false);
    ArgumentCaptor<Throwable> ac = ArgumentCaptor.forClass(Throwable.class);
    verify(exceptionHandlerMock).handleException(ac.capture());
    assertEquals(ac.getValue().getMessage(), exMessage);
    assertTrue(ac.getValue() instanceof SakuliValidationException);
    assertTrue(ac.getValue() instanceof NonScreenshotException);
    assertFalse(ac.getValue() instanceof SakuliActionException);
}
Also used : NonScreenshotException(org.sakuli.exceptions.NonScreenshotException) SakuliValidationException(org.sakuli.exceptions.SakuliValidationException) Matchers.anyString(org.mockito.Matchers.anyString) SakuliActionException(org.sakuli.exceptions.SakuliActionException) Test(org.testng.annotations.Test) BaseTest(org.sakuli.BaseTest)

Aggregations

Matchers.anyString (org.mockito.Matchers.anyString)2 BaseTest (org.sakuli.BaseTest)2 NonScreenshotException (org.sakuli.exceptions.NonScreenshotException)2 SakuliActionException (org.sakuli.exceptions.SakuliActionException)2 SakuliValidationException (org.sakuli.exceptions.SakuliValidationException)2 Test (org.testng.annotations.Test)2