Search in sources :

Example 1 with DummySmackIntegrationTestFramework

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();
}
Also used : DummySmackIntegrationTestFramework(org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework) 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)

Example 2 with DummySmackIntegrationTestFramework

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);
}
Also used : DummySmackIntegrationTestFramework(org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework) 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)

Example 3 with DummySmackIntegrationTestFramework

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());
}
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)3 DummySmackIntegrationTestFramework (org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework)3 FailedTest (org.igniterealtime.smack.inttest.FailedTest)3 SmackIntegrationTest (org.igniterealtime.smack.inttest.SmackIntegrationTest)3 SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest (org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest)3 Test (org.junit.Test)3 TestRunResult (org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult)1 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)1