Added isModified method to Resource, Reservation.
[staff/due1/sed-hs15-srs-purple.git] / src / test / java / ch / bfh / ti / srs / dataschema / ResourceTest.java
index 6e5b1f6..6114dbe 100644 (file)
@@ -8,7 +8,9 @@
 package ch.bfh.ti.srs.dataschema;\r
 \r
 import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertFalse;\r
 import static org.junit.Assert.assertNotEquals;\r
+import static org.junit.Assert.assertTrue;\r
 \r
 import org.junit.Test;\r
 \r
@@ -46,4 +48,21 @@ public class ResourceTest {
                testRessource.setType(null);\r
                assertEquals(null, testRessource.getType());\r
        }\r
+       \r
+       @Test\r
+       public void isModifiedTest() throws Exception {\r
+               Resource testRessource = new Resource("N321", "class room");\r
+               Resource clonedTestRessource = testRessource.clone();\r
+               \r
+               assertFalse(testRessource.isModified(clonedTestRessource));\r
+               assertTrue(testRessource.isModified(null));\r
+               assertFalse(testRessource.isModified(testRessource));\r
+               clonedTestRessource.setName("N421");\r
+               assertTrue(testRessource.isModified(clonedTestRessource));\r
+               clonedTestRessource.setName("N321");\r
+               assertFalse(testRessource.isModified(clonedTestRessource));\r
+               clonedTestRessource.setType("lecture hall");\r
+               assertTrue(testRessource.isModified(clonedTestRessource));\r
+       }\r
 }\r
+\r