use of org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework in project Smack by igniterealtime.
the class SmackIntegrationTestFrameworkUnitTest method throwsRuntimeExceptionsTest.
@Test
public void throwsRuntimeExceptionsTest() throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException {
expectedException.expect(RuntimeException.class);
expectedException.expectMessage(ThrowsRuntimeExceptionDummyTest.RUNTIME_EXCEPTION_MESSAGE);
DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(ThrowsRuntimeExceptionDummyTest.class);
sinttest.run();
}
use of org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework in project Smack by igniterealtime.
the class SmackIntegrationTestFrameworkUnitTest method testInvoking.
@Test
public void testInvoking() throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException {
beforeClassInvoked = false;
afterClassInvoked = false;
DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(BeforeAfterClassTest.class);
sinttest.run();
assertTrue("A before class method should have been executed to this time", beforeClassInvoked);
assertTrue("A after class method should have been executed to this time", afterClassInvoked);
}
use of org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework 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());
}
Aggregations