Examples of EntityA


Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

                .next());
    }

    @Test
    public void sharedValueElementsKeepTheSameReferencesForTheValues() {
        EntityA entityA = new EntityA();
        Map<Object, Object> originalMap = new HashMap<Object, Object>();
        EntityA originalValue = new EntityA();
        Date originalKey = new Date();
        originalMap.put(originalKey, originalValue);
        entityA.setSharedValuesMapProperty(originalMap);
        EntityA copy = new DeepCopy().copy(entityA);
        Map<Object, Object> copiedMap = copy
                .getSharedValuesMapProperty();
        assertNotSame(originalKey, copiedMap.keySet().iterator()
                .next());
        assertSame(originalValue, copiedMap.values().iterator()
                .next());
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

                .next());
    }

    @Test
    public void aSharedCollectionElementsMapKeepTheSameReferencesForTheKeysAndTheValues() {
        EntityA entityA = new EntityA();
        Map<Object, Object> originalMap = new HashMap<Object, Object>();
        EntityA originalValue = new EntityA();
        Date originalKey = new Date();
        originalMap.put(originalKey, originalValue);
        entityA.setSharedCollectionElementsMapProperty(originalMap);
        EntityA copy = new DeepCopy().copy(entityA);
        Map<Object, Object> copiedMap = copy
                .getSharedCollectionElementsMapProperty();
        assertSame(originalKey, copiedMap.keySet().iterator()
                .next());
        assertSame(originalValue, copiedMap.values().iterator()
                .next());
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

    }

    @Test
    public void ifNotInnmutableNorCustomCopyRecursivelyCopiesIt() {
        Parent parent = new Parent();
        EntityA entityAProperty = new EntityA();
        Date originalDate = new Date();
        entityAProperty.setDate(originalDate);
        parent.setEntityAProperty(entityAProperty);
        Parent copy = new DeepCopy().copy(parent);
        assertNotSame(parent, copy);
        assertThat(copy.getEntityAProperty().getDate(), equalTo(originalDate));
        assertNotSame(copy.getEntityAProperty().getDate(), originalDate);
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

    }

    @Test
    public void alreadyCopiedInstancesAreReused() {
        Parent parent = new Parent();
        EntityA entityA = new EntityA();
        parent.setEntityAProperty(entityA);
        entityA.setParentProperty(parent);
        Parent copy = new DeepCopy().copy(parent);
        assertSame(copy, copy.getEntityAProperty().getParentProperty());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

    }

    @Test
    public void alreadyCopiedSetsAreReused() {
        Parent parent = new Parent();
        EntityA entityA = new EntityA();
        parent.setEntityAProperty(entityA);
        entityA.setParentProperty(parent);
        HashSet<Object> originalSet = new HashSet<Object>();
        parent.setSetProperty(originalSet);
        entityA.setSetProperty(originalSet);
        Parent copy = new DeepCopy().copy(parent);
        assertSame(copy.getSetProperty(), copy.getEntityAProperty()
                .getSetProperty());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

    @Test
    public void canSpecifyReplacements() {
        DeepCopy deepCopy = new DeepCopy();
        Parent parent = new Parent();
        EntityA entityA = new EntityA();
        parent.setEntityAProperty(entityA);
        EntityA anotherEntity = new EntityA();
        deepCopy.replace(entityA, anotherEntity);
        Parent copy = deepCopy.copy(parent);
        assertSame(copy.getEntityAProperty(), anotherEntity);
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

    }

    @Test
    public void afterCopyHooksCanBeDefined() {
        DeepCopy deepCopy = new DeepCopy();
        EntityA entityA = new EntityA();
        EntityA copy = deepCopy.copy(entityA);
        assertTrue(copy.isFirstHookCalled());
        assertTrue(copy.isSecondHookCalled());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

        assertTrue(subclass.isAfterCopyHookCalled());
    }

    @Test
    public void equalObjectsButDifferentAreNotReused() {
        EntityA entityA = new EntityA();
        DeepCopy deepCopy = new DeepCopy();
        entityA.setSet1(new HashSet<Object>());
        entityA.setSet2(new HashSet<Object>());
        EntityA copied = deepCopy.copy(entityA);
        assertNotSame(copied.getSet1(), copied.getSet2());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

        new DeepCopy().copy(entity);
    }

    @Test
    public void stringPropertiesAreShared() {
        EntityA entityA = new EntityA();
        entityA.setStringProperty("foo");
        EntityA copy = new DeepCopy().copy(entityA);
        assertSame(entityA.getStringProperty(), copy.getStringProperty());
    }
View Full Code Here

Examples of org.libreplan.business.util.deepcopy.EntityExamples.EntityA

        assertSame(entityA.getStringProperty(), copy.getStringProperty());
    }

    @Test
    public void intPropertiesAreShared() {
        EntityA entityA = new EntityA();
        EntityA copy = new DeepCopy().copy(entityA);
        assertEquals(entityA.getIntProperty(), copy.getIntProperty());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.