JUnit 4 Template Class
Each time I want to create a JUnit test class, I take a look at an older one, copy it, then remove all of the specifics of the previous tests.
That isn't a good practice :-)
So I've decided to do it once more, in order to create a template - a working JUnit class which doesn't do anything, just add your specific code you want to test and run along:
That isn't a good practice :-)
So I've decided to do it once more, in order to create a template - a working JUnit class which doesn't do anything, just add your specific code you want to test and run along:
package org.chaiavi.TestJunit;import java.io.IOException;import org.junit.*;import static org.junit.Assert.*;public class TestJunit{/** Use this method for all of the lines of code you want to run before the whole JUnit Class. */@BeforeClasspublic static void unitSetup() throws Exception {}/** Use this method for all of the lines of code you want to run after the whole JUnit Class. */@AfterClasspublic static void unitCleanup() throws Exception {}/** Use this method for all of the lines of code you want to run before each JUnit test. */@Beforepublic void methodSetup() throws Exception {}/** Use this method for all of the lines of code you want to run after each JUnit test. */@Afterpublic void methodCleanup() throws Exception {}/** Use the Test annotation for each JUnit Test method. */@Testpublic void runTest() {}}
Comments