fix WolfSSLSession unit tests, switch test order

pull/2/head
Chris Conlon 2014-04-16 14:55:42 -06:00
parent fbd4266c35
commit d8afacd8d1
3 changed files with 28 additions and 23 deletions

View File

@ -33,34 +33,29 @@ public class WolfSSLSessionTest {
@Test @Test
public void testWolfSSLSession() throws WolfSSLException { public void testWolfSSLSession() throws WolfSSLException {
WolfSSL lib = null; WolfSSLContext ctx = null;
WolfSSLSession ssl = null;
try { ctx = new WolfSSLContext(WolfSSL.SSLv23_ClientMethod());
lib = new WolfSSL();
} catch (WolfSSLException e) {
fail("failed to create WolfSSL object");
}
System.out.println("WolfSSLSession Class"); System.out.println("WolfSSLSession Class");
test_WolfSSL_new(lib); test_WolfSSLSession_new(ssl, ctx);
} }
public void test_WolfSSL_new(WolfSSL lib) { public void test_WolfSSLSession_new(WolfSSLSession ssl,
WolfSSLContext ctx) {
try { try {
System.out.print("\tWolfSSL()"); System.out.print("\tWolfSSLSession()");
lib = new WolfSSL(); ssl = new WolfSSLSession(ctx);
} catch (UnsatisfiedLinkError ule) {
System.out.println("\t\t... failed");
fail("failed to load native JNI library");
} catch (WolfSSLException we) { } catch (WolfSSLException we) {
System.out.println("\t\t... failed"); System.out.println("\t... failed");
fail("failed to create WolfSSL object"); fail("failed to create WolfSSLSession object");
} }
System.out.println("\t\t... passed"); System.out.println("\t... passed");
} }
} }

View File

@ -44,17 +44,27 @@ public class WolfSSLTest {
public void testWolfSSL() throws WolfSSLException { public void testWolfSSL() throws WolfSSLException {
WolfSSL lib = null; WolfSSL lib = null;
System.out.println("WolfSSL Class");
test_WolfSSL_new(lib);
test_WolfSSL_Method_Allocators(lib);
}
public void test_WolfSSL_new(WolfSSL lib) {
try { try {
System.out.print("\tWolfSSL()");
lib = new WolfSSL(); lib = new WolfSSL();
} catch (WolfSSLException e) { } catch (UnsatisfiedLinkError ule) {
System.out.println("\t\t... failed");
fail("failed to load native JNI library");
} catch (WolfSSLException we) {
System.out.println("\t\t... failed");
fail("failed to create WolfSSL object"); fail("failed to create WolfSSL object");
} }
System.out.println("WolfSSL Class"); System.out.println("\t\t... passed");
test_WolfSSL_Method_Allocators(lib);
} }
public void test_WolfSSL_Method_Allocators(WolfSSL lib) { public void test_WolfSSL_Method_Allocators(WolfSSL lib) {

View File

@ -27,8 +27,8 @@ import org.junit.runners.Suite;
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({ @Suite.SuiteClasses({
WolfSSLTest.class, WolfSSLTest.class,
WolfSSLSessionTest.class, WolfSSLContextTest.class,
WolfSSLContextTest.class WolfSSLSessionTest.class
}) })
public class WolfSSLTestSuite { public class WolfSSLTestSuite {