Video Tutorials for CSE219

Home   .   Projects   .   Debugging   .   Design   .   CVS   .   JUnit

Video Tutorial 5 - JUnit
Download the video tutorial (high resolution, may need additional codecs)
or view the video tutorial by clicking on the "play" button below.

JUnit Web Site


Example files used in the tutorial:
  - DollarConverter.zip
  - DollarConverterTest.java
  - DollarConverterGUITest.java


The following code can be used as a template for creating a JUnit test class:

import org.junit.*; public class ExampleTest { /** * methods annotated with @BeforeClass are * called once before the test methods run */ @BeforeClass public static void setUpBeforeClass() { ; } /** * methods annotated with @AfterClass are * called once after all test methods run */ @AfterClass public static void tearDownAfterClass() { ; } /** * methods annotated with @Before are * called before every test case method */ @Before public void setUp() { ; } /** * methods annotated with @After are * called after every test case method */ @After public void tearDown() { ; } /** * methods annotated with @Test are * your actual Unit Test methods * test using: * Assert.assertEquals * Assert.assertTrue * Assert.assertFalse * Assert.assertNotNull * Assert.assertNull * etc. */ @Test public void firstTest() { ; } @Test public void secondTest() { ; } @Test(expected=Exception.class) public void checkExceptionTest() { ; } }

CSE219 Course Web Site

TA: Young Chol Song
Office Hours (Fall 2007): Monday 11:50AM-1:50PM at CS Bldg 2110
E-mail: yosong at ic.sunysb.edu