🏡 index : ~doyle/blockbuster.git

author Jordan Doyle <jordan.doyle@outlook.com> 2015-04-13 0:22:56.0 +00:00:00
committer Jordan Doyle <jordan.doyle@outlook.com> 2015-04-13 0:22:56.0 +00:00:00
commit
187aaf53c19ff8d3679957b9612d63e710d7a60c [patch]
tree
fff9da4124e13923e49fb8ed71f552079b2e3c3e
parent
a17e392240c09d1b161c0215be86a67215f90c21
download
187aaf53c19ff8d3679957b9612d63e710d7a60c.tar.gz

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(-)

diff --git a/pom.xml b/pom.xml
index e54eea8..4ccabc7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
      
diff --git a/src/test/java/wf/doyle/blockbuster/AppTest.java b/src/test/java/wf/doyle/blockbuster/AppTest.java
index 9993855..b953dcd 100644
--- a/src/test/java/wf/doyle/blockbuster/AppTest.java
+++ b/src/test/java/wf/doyle/blockbuster/AppTest.java
@@ -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);
		}
	}
}
diff --git a/target/test-classes/wf/doyle/blockbuster/AppTest.class b/target/test-classes/wf/doyle/blockbuster/AppTest.class
index 87f8bba..f01aa7b 100644
Binary files a/target/test-classes/wf/doyle/blockbuster/AppTest.class and b/target/test-classes/wf/doyle/blockbuster/AppTest.class differ