[Batchserver-cvs] batchserver/test/org/jmonks/batchserver/framework/common ErrorCodeTest.java,NONE,1
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-04 04:20:40
|
Update of /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11196/org/jmonks/batchserver/framework/common Modified Files: FrameworkUtilTest.java Added Files: ErrorCodeTest.java StatusCodeTest.java Log Message: submitting the junits for ErrorCode, StatusCode and FrameworkUtil Index: FrameworkUtilTest.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/test/org/jmonks/batchserver/framework/common/FrameworkUtilTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FrameworkUtilTest.java 1 Feb 2006 05:05:38 -0000 1.1 --- FrameworkUtilTest.java 4 Mar 2006 04:20:34 -0000 1.2 *************** *** 1,13 **** package org.jmonks.batchserver.framework.common; import junit.framework.TestCase; public class FrameworkUtilTest extends TestCase { ! public void testPrintMessage() ! { ! FrameworkUtil.printMessage("This is testing printMessage method"); ! } } \ No newline at end of file --- 1,54 ---- package org.jmonks.batchserver.framework.common; + import junit.framework.Test; import junit.framework.TestCase; + import junit.framework.TestSuite; public class FrameworkUtilTest extends TestCase { + public FrameworkUtilTest(String testName) + { + super(testName); + } + /** + * Test case to check that FrameworkUtil cannot be instantiated. + */ + public void testInstantiation() + { + try + { + FrameworkUtil utility=(FrameworkUtil)FrameworkUtil.class.newInstance(); + fail("FrameworkUtil should not be instantiated."); + } + catch(InstantiationException ex) + { + /** + * This is expected as Frameworkutil cannot be instantiated. + */ + } + catch(IllegalAccessException ex) + { + /** + * This is expected as the constructor of FrameworkUtil is private. + */ + } + } ! protected void tearDown() throws Exception ! { ! ! super.tearDown(); ! } ! ! protected void setUp() throws Exception ! { ! ! super.setUp(); ! } + public static Test suite() + { + TestSuite suite=new TestSuite(FrameworkUtilTest.class); + return suite; + } } \ No newline at end of file --- NEW FILE: ErrorCodeTest.java --- /* * ErrorCodeTest.java * JUnit based test * * Created on March 3, 2006, 8:12 PM */ package org.jmonks.batchserver.framework.common; import junit.framework.*; /** * Test cases to test the ErrorCode.java. * * @author Suresh Pragada */ public class ErrorCodeTest extends TestCase { public ErrorCodeTest(String testName) { super(testName); } protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } public static Test suite() { TestSuite suite = new TestSuite(ErrorCodeTest.class); return suite; } /** * Test that getCode is returning the expected errorCode. */ public void testGetCode() { ErrorCode errorCode=ErrorCode.JOB_NOT_CONFIGURED; int code=errorCode.getCode(); Assert.assertEquals(1002,code); } /** * Test that getMessage is not returning null. */ public void testGetMessage() { ErrorCode errorCode=ErrorCode.JOB_NOT_CONFIGURED; String message=errorCode.getMessage(); Assert.assertNotNull(message); } /** * Test that ErrorCode cannot be instantiated. */ public void testInstantiation() { try { ErrorCode errorCode=(ErrorCode)ErrorCode.class.newInstance(); fail("ErrorCode should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as ErrorCode cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of ErrorCode is private. */ } } } --- NEW FILE: StatusCodeTest.java --- /* * StatusCodeTest.java * JUnit based test * * Created on March 3, 2006, 8:35 PM */ package org.jmonks.batchserver.framework.common; import junit.framework.*; /** * Test cases to test the StatusCode.java. * * @author Suresh Pragada */ public class StatusCodeTest extends TestCase { public StatusCodeTest(String testName) { super(testName); } protected void setUp() throws Exception { } protected void tearDown() throws Exception { } public static Test suite() { TestSuite suite = new TestSuite(StatusCodeTest.class); return suite; } /** * Test that getCode is returning expected values. */ public void testGetCode() { StatusCode statusCode=StatusCode.SUCCESS; int code=statusCode.getCode(); Assert.assertEquals(0,code); } /** * Test that StatusCode cannot be instantiated. */ public void testInstantiation() { try { StatusCode statusCode=(StatusCode)StatusCode.class.newInstance(); fail("StatusCode should not be instantiated."); } catch(InstantiationException ex) { /** * This is expected as StatusCode cannot be instantiated. */ } catch(IllegalAccessException ex) { /** * This is expected as the constructor of StatusCode is private. */ } } } |