Search in sources :

Example 1 with FailedTest

use of org.igniterealtime.smack.inttest.FailedTest in project Smack by igniterealtime.

the class SmackIntegrationTestFrameworkUnitTest method logsNonFatalExceptionTest.

@Test
public void logsNonFatalExceptionTest() throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException {
    DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(ThrowsNonFatalExceptionDummyTest.class);
    TestRunResult testRunResult = sinttest.run();
    List<FailedTest> failedTests = testRunResult.getFailedTests();
    assertEquals(1, failedTests.size());
    FailedTest failedTest = failedTests.get(0);
    assertTrue(failedTest.failureReason instanceof XMPPErrorException);
    XMPPErrorException ex = (XMPPErrorException) failedTest.failureReason;
    assertEquals(XMPPError.Condition.bad_request, ex.getXMPPError().getCondition());
    assertEquals(ThrowsNonFatalExceptionDummyTest.DESCRIPTIVE_TEXT, ex.getXMPPError().getDescriptiveText());
}
Also used : XMPPErrorException(org.jivesoftware.smack.XMPPException.XMPPErrorException) TestRunResult(org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult) DummySmackIntegrationTestFramework(org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework) FailedTest(org.igniterealtime.smack.inttest.FailedTest) FailedTest(org.igniterealtime.smack.inttest.FailedTest) AbstractSmackIntegrationTest(org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest) SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest(org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest) Test(org.junit.Test) SmackIntegrationTest(org.igniterealtime.smack.inttest.SmackIntegrationTest)

Aggregations

AbstractSmackIntegrationTest (org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest)1 DummySmackIntegrationTestFramework (org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework)1 FailedTest (org.igniterealtime.smack.inttest.FailedTest)1 SmackIntegrationTest (org.igniterealtime.smack.inttest.SmackIntegrationTest)1 TestRunResult (org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult)1 SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest (org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest)1 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)1 Test (org.junit.Test)1