clearer getters for DerivedUnitFacade + PointBeanProcessor
[cdmlib.git] / cdmlib-services / src / test / java / eu / etaxonomy / cdm / api / facade / DerivedUnitFacadeTest.java
index 52b9a3ccef162c404c96f938b8bd4a05b238fd9f..a5371b2981cc8a53e5ea36751450f5804b416325 100644 (file)
@@ -182,7 +182,7 @@ public class DerivedUnitFacadeTest {
         */\r
        @Test\r
        public void testNewInstance() {\r
-               Assert.assertNotNull("The specimen should have been created", specimenFacade.getDerivedUnit());\r
+               Assert.assertNotNull("The specimen should have been created", specimenFacade.innerDerivedUnit());\r
                //???\r
 //             Assert.assertNotNull("The derivation event should have been created", specimenFacade.getSpecimen().getDerivedFrom());\r
 //             Assert.assertNotNull("The field observation should have been created", specimenFacade.getFieldObservation());\r
@@ -194,10 +194,10 @@ public class DerivedUnitFacadeTest {
         */\r
        @Test\r
        public void testNewInstanceSpecimen() {\r
-               Assert.assertSame("Specimen should be same", specimen, specimenFacade.getDerivedUnit());\r
-               Assert.assertSame("Derivation event should be same", derivationEvent, specimenFacade.getDerivedUnit().getDerivedFrom());\r
-               Assert.assertSame("Field observation should be same", fieldObservation, specimenFacade.getFieldObservation());\r
-               Assert.assertSame("Gathering event should be same", gatheringEvent, specimenFacade.getGatheringEvent());\r
+               Assert.assertSame("Specimen should be same", specimen, specimenFacade.innerDerivedUnit());\r
+               Assert.assertSame("Derivation event should be same", derivationEvent, specimenFacade.innerDerivedUnit().getDerivedFrom());\r
+               Assert.assertSame("Field observation should be same", fieldObservation, specimenFacade.innerFieldObservation());\r
+               Assert.assertSame("Gathering event should be same", gatheringEvent, specimenFacade.innerGatheringEvent());\r
        \r
        }\r
 \r
@@ -209,7 +209,7 @@ public class DerivedUnitFacadeTest {
                        specimenFacade = DerivedUnitFacade.NewInstance(specimen);\r
                        specimenFacade.setDistanceToGround(2);\r
                        FieldObservation specimenFieldObservation = (FieldObservation)specimen.getDerivedFrom().getOriginals().iterator().next();\r
-                       Assert.assertSame("Facade gathering event and specimen gathering event should be the same",specimenFacade.getGatheringEvent(), specimenFieldObservation.getGatheringEvent());\r
+                       Assert.assertSame("Facade gathering event and specimen gathering event should be the same",specimenFacade.innerGatheringEvent(), specimenFieldObservation.getGatheringEvent());\r
                } catch (DerivedUnitFacadeNotSupportedException e) {\r
                        Assert.fail("An error should not occur in NewInstance()");\r
                }\r
@@ -221,7 +221,7 @@ public class DerivedUnitFacadeTest {
                DerivedUnitFacade specimenFacade;\r
                try {\r
                        specimenFacade = DerivedUnitFacade.NewInstance(specimen);\r
-                       Assert.assertNull("No field observation should exists", specimenFacade.getFieldObservation());\r
+                       Assert.assertNull("No field observation should exists", specimenFacade.innerFieldObservation());\r
                } catch (DerivedUnitFacadeNotSupportedException e) {\r
                        Assert.fail("An error should not occur in NewInstance()");\r
                }\r
@@ -243,7 +243,7 @@ public class DerivedUnitFacadeTest {
                NamedArea newCollectingArea = NamedArea.NewInstance("A nice area", "nice", "n");\r
                specimenFacade.addCollectingArea(newCollectingArea);\r
                Assert.assertEquals("Exactly 1 area must exist", 1, specimenFacade.getCollectingAreas().size());\r
-               Assert.assertSame("Areas should be same", newCollectingArea, specimenFacade.getFieldObservation().getGatheringEvent().getCollectingAreas().iterator().next());\r
+               Assert.assertSame("Areas should be same", newCollectingArea, specimenFacade.innerFieldObservation().getGatheringEvent().getCollectingAreas().iterator().next());\r
                specimenFacade.addCollectingArea(tdwgArea);\r
                Assert.assertEquals("Exactly 2 areas must exist", 2, specimenFacade.getCollectingAreas().size());\r
                specimenFacade.removeCollectingArea(newCollectingArea);\r
@@ -372,7 +372,7 @@ public class DerivedUnitFacadeTest {
                emptyFacade.setDistanceToWaterSurface(13);\r
                Assert.assertNotNull("Field observation must exist if distance to water exists", emptyFacade.getFieldObservation(false));\r
                Assert.assertNotNull("Gathering event must exist if distance to water exists", emptyFacade.getGatheringEvent(false));\r
-               FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.getDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
+               FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.innerDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
                Assert.assertSame("Gathering event of facade and of specimen must be the same", specimenFieldObservation.getGatheringEvent(), emptyFacade.getGatheringEvent(false));\r
        }\r
 \r
@@ -391,7 +391,7 @@ public class DerivedUnitFacadeTest {
        public void testSetExactLocationByParsing(){\r
                Point point1;\r
                try {\r
-                       specimenFacade.setExactLocationByParsing("11¡34'20\"W", "34¡30,34'N", null, null);\r
+                       specimenFacade.setExactLocationByParsing("112\u00B034'20\"W", "34\u00B030,34'N", null, null);\r
                        point1 = specimenFacade.getExactLocation();\r
                        Assert.assertNotNull("", point1.getLatitude());\r
                        System.out.println(point1.getLatitude().toString());\r
@@ -587,7 +587,7 @@ public class DerivedUnitFacadeTest {
                Assert.assertNull("Empty facace must not have any field value" ,emptyFacade.getFieldNumber());\r
                emptyFacade.setFieldNumber("1256A");\r
                Assert.assertNotNull("Field observation must exist if field number exists", emptyFacade.getFieldObservation(false));\r
-               FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.getDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
+               FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.innerDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
                Assert.assertSame("Field observation of facade and of specimen must be the same", specimenFieldObservation, emptyFacade.getFieldObservation(false));\r
                Assert.assertEquals("1256A", emptyFacade.getFieldNumber());\r
        }\r
@@ -612,16 +612,16 @@ public class DerivedUnitFacadeTest {
                Assert.assertFalse("The initial distance to ground should not be 43", specimenFacade.getDistanceToGround() == 43);\r
                specimenFacade.setGatheringEvent(newGatheringEvent);\r
                Assert.assertTrue("The final distance to ground should be 43", specimenFacade.getDistanceToGround() == 43);\r
-               Assert.assertSame("The new gathering event should be 'newGatheringEvent'", newGatheringEvent, specimenFacade.getGatheringEvent());\r
+               Assert.assertSame("The new gathering event should be 'newGatheringEvent'", newGatheringEvent, specimenFacade.innerGatheringEvent());\r
        }\r
 \r
        /**\r
-        * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#getGatheringEvent()}.\r
+        * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#innerGatheringEvent()}.\r
         */\r
        @Test\r
        public void testGetGatheringEvent() {\r
-               Assert.assertNotNull("Gathering event must not be null", specimenFacade.getGatheringEvent());   \r
-               Assert.assertEquals("Gathering event must be field observations gathering event", specimenFacade.getFieldObservation().getGatheringEvent(), specimenFacade.getGatheringEvent());\r
+               Assert.assertNotNull("Gathering event must not be null", specimenFacade.innerGatheringEvent()); \r
+               Assert.assertEquals("Gathering event must be field observations gathering event", specimenFacade.innerFieldObservation().getGatheringEvent(), specimenFacade.innerGatheringEvent());\r
        }\r
 \r
        /**\r
@@ -850,11 +850,11 @@ public class DerivedUnitFacadeTest {
        }\r
 \r
        /**\r
-        * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#getDerivedUnit()}.\r
+        * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#innerDerivedUnit()}.\r
         */\r
        @Test\r
        public void testGetSpecimen() {\r
-               Assert.assertEquals("Specimen must be same", specimen, specimenFacade.getDerivedUnit());        \r
+               Assert.assertEquals("Specimen must be same", specimen, specimenFacade.innerDerivedUnit());      \r
        }\r
 \r
        /**\r
@@ -905,7 +905,7 @@ public class DerivedUnitFacadeTest {
                specimenFacade.removeDuplicate(newSpecimen1);\r
                Assert.assertEquals("There should be 1 duplicate now", 1, specimenFacade.getDuplicates().size());\r
                Assert.assertSame("The only duplicate should be 'newSpecimen2' now", newSpecimen2, specimenFacade.getDuplicates().iterator().next());\r
-               specimenFacade.addDuplicate(specimenFacade.getDerivedUnit());\r
+               specimenFacade.addDuplicate(specimenFacade.innerDerivedUnit());\r
                Assert.assertEquals("There should be still 1 duplicate because the facade specimen is not a duplicate", 1, specimenFacade.getDuplicates().size());\r
                \r
                Collection newCollection = Collection.NewInstance();\r
@@ -932,7 +932,7 @@ public class DerivedUnitFacadeTest {
                } catch (DerivedUnitFacadeNotSupportedException e) {\r
                        Assert.fail("Multiple derivation events in line should not throw a not supported exception");\r
                }\r
-               Assert.assertSame("Gathering event should derive from the derivation line", existingGatheringEvent, specimenFacade.getGatheringEvent());\r
+               Assert.assertSame("Gathering event should derive from the derivation line", existingGatheringEvent, specimenFacade.innerGatheringEvent());\r
                Assert.assertEquals("Mediasize should be 0. Only Imagegallery media are supported", 0, specimenFacade.getFieldObjectMedia().size());\r
        }\r
        \r