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
public void testWolfSSLSession() throws WolfSSLException {
WolfSSL lib = null;
WolfSSLContext ctx = null;
WolfSSLSession ssl = null;
try {
lib = new WolfSSL();
} catch (WolfSSLException e) {
fail("failed to create WolfSSL object");
}
ctx = new WolfSSLContext(WolfSSL.SSLv23_ClientMethod());
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 {
System.out.print("\tWolfSSL()");
lib = new WolfSSL();
} catch (UnsatisfiedLinkError ule) {
System.out.println("\t\t... failed");
fail("failed to load native JNI library");
System.out.print("\tWolfSSLSession()");
ssl = new WolfSSLSession(ctx);
} catch (WolfSSLException we) {
System.out.println("\t\t... failed");
fail("failed to create WolfSSL object");
System.out.println("\t... failed");
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 {
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 {
System.out.print("\tWolfSSL()");
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");
}
System.out.println("WolfSSL Class");
test_WolfSSL_Method_Allocators(lib);
System.out.println("\t\t... passed");
}
public void test_WolfSSL_Method_Allocators(WolfSSL lib) {

View File

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