Commit 37a7b38
Changed files (4)
assignments
assignment1
src
main
java
ca
mokhan
assignment1
test
java
ca
mokhan
assignment1
assignments/assignment1/src/main/java/ca/mokhan/assignment1/AddressBook.java
@@ -0,0 +1,16 @@
+package ca.mokhan.assignment1;
+
+public class AddressBook
+{
+ private String firstName;
+
+ public void setFirstName(String name)
+ {
+ this.firstName = name;
+ }
+
+ public String getFirstName()
+ {
+ return this.firstName;
+ }
+}
assignments/assignment1/src/main/java/ca/mokhan/assignment1/App.java
@@ -1,13 +1,9 @@
package ca.mokhan.assignment1;
-/**
- * Hello world!
- *
- */
-public class App
+public class App
{
- public static void main( String[] args )
- {
- System.out.println( "Hello World!" );
- }
+ public static void main(String[] args)
+ {
+ System.out.println("Hello World!");
+ }
}
assignments/assignment1/src/test/java/ca/mokhan/assignment1/AddressBookTest.java
@@ -0,0 +1,26 @@
+package ca.mokhan.assignment1;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class AddressBookTest extends TestCase
+{
+ public AddressBookTest(String testName)
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(AddressBookTest.class);
+ }
+
+ public void testFirstName()
+ {
+ AddressBook addressBook = new AddressBook();
+ addressBook.setFirstName("mo");
+ String actual = addressBook.getFirstName();
+ assertEquals(actual, "mo");
+ }
+}
assignments/assignment1/src/test/java/ca/mokhan/assignment1/AppTest.java
@@ -4,35 +4,20 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-/**
- * Unit test for simple App.
- */
-public class AppTest
- extends TestCase
+public class AppTest extends TestCase
{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
+ public AppTest(String testName)
+ {
+ super(testName);
+ }
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
+ public static Test suite()
+ {
+ return new TestSuite(AppTest.class);
+ }
- /**
- * Rigourous Test :-)
- */
- public void testApp()
- {
- assertTrue( true );
- }
+ public void testApp()
+ {
+ assertTrue(true);
+ }
}