Start JUnit testing
Diff
pom.xml | 2 +-
src/test/java/wf/doyle/blockbuster/AppTest.java | 62 +++++++++----------
target/test-classes/wf/doyle/blockbuster/AppTest.class | Bin 627 -> 1626 bytes
3 files changed, 31 insertions(+), 33 deletions(-)
@@ -17,7 +17,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
@@ -1,38 +1,36 @@
package wf.doyle.blockbuster;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import java.lang.reflect.Field;
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
import org.junit.Assert;
import org.junit.Test;
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
import wf.doyle.blockbuster.file.FileReader;
import wf.doyle.blockbuster.item.LibraryItem;
import wf.doyle.blockbuster.item.items.audiovisual.DVD;
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
* Unit test for blockbuster
*/
public class AppTest {
*
*/
@Test
public void assertReflection() {
LibraryItem item = new DVD();
Field f = FileReader.getField("title", item.getClass());
Assert.assertNotNull(f);
LibraryItem i = FileReader.setField(f, item, "testCase");
try {
Assert.assertEquals(f.get(i), "testCase");
} catch(Exception e) {
Assert.fail("Getting value of String using reflection failed");
e.printStackTrace(System.err);
}
}
}
Binary files a/target/test-classes/wf/doyle/blockbuster/AppTest.class and b/target/test-classes/wf/doyle/blockbuster/AppTest.class differ