Examples of EntityA


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

        assertThat(copy.getSetProperty(), instanceOf(LinkedHashSet.class));
    }

    @Test
    public void setsInsideSetsAreRecursivelyCopiedWithoutProblem() {
        EntityA entityA = new EntityA();
        HashSet<Object> innerSet = new HashSet<Object>(asList("bla", 3));
        HashSet<Object> originalSet = new HashSet<Object>(asList("test", 2, 3,
                new Date(), innerSet));
        entityA.setSetProperty(originalSet);
        EntityA copy = new DeepCopy().copy(entityA);
        assertEquals(originalSet, copy.getSetProperty());
        assertNotSame(originalSet, copy.getSetProperty());
    }
View Full Code Here

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

        assertNotSame(originalSet, copy.getSetProperty());
    }

    @Test
    public void mapsAreCopied() {
        EntityA entityA = new EntityA();
        HashMap<Object, Object> originalMap = new HashMap<Object, Object>();
        originalMap.put("aa", "blabla");
        entityA.setMapProperty(originalMap);
        EntityA copy = new DeepCopy().copy(entityA);
        assertEquals(originalMap, copy.getMapProperty());
        assertNotSame(originalMap, copy.getMapProperty());
    }
View Full Code Here

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

        assertNotSame(originalMap, copy.getMapProperty());
    }

    @Test
    public void mapImplementationIsPreservedIfPossible() {
        EntityA entityA = new EntityA();
        LinkedHashMap<Object, Object> mapProperty = new LinkedHashMap<Object, Object>();
        mapProperty.put("ab", "abc");
        entityA.setMapProperty(mapProperty);
        EntityA copy = new DeepCopy().copy(entityA);
        assertThat(copy.getMapProperty(), instanceOf(LinkedHashMap.class));
    }
View Full Code Here

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

        assertThat(copy.getMapProperty(), instanceOf(LinkedHashMap.class));
    }

    @Test
    public void listsAreCopied() {
        EntityA entityA = new EntityA();
        ArrayList<Object> originalList = new ArrayList<Object>();
        originalList.add(2);
        originalList.add(10);
        originalList.add("abla");
        entityA.setListProperty(originalList);
        EntityA copy = new DeepCopy().copy(entityA);
        assertEquals(originalList, copy.getListProperty());
        assertNotSame(originalList, copy.getListProperty());
    }
View Full Code Here

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

        assertNotSame(originalList, copy.getListProperty());
    }

    @Test
    public void listImplementationIsPreservedIfPossible() {
        EntityA entityA = new EntityA();
        LinkedList<Object> originalList = new LinkedList<Object>();
        originalList.add(2);
        entityA.setListProperty(originalList);
        EntityA copy = new DeepCopy().copy(entityA);
        assertThat(copy.getListProperty(), instanceOf(LinkedList.class));
    }
View Full Code Here

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

        assertThat(copy.getListProperty(), instanceOf(LinkedList.class));
    }

    @Test
    public void ignoredFieldsAreNotCopied() {
        EntityA entityA = new EntityA();
        entityA.setIgnoredProperty("blabla");
        EntityA copy = new DeepCopy().copy(entityA);
        assertThat(copy.getIgnoredProperty(), nullValue());
    }
View Full Code Here

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

        assertThat(copy.getIgnoredProperty(), nullValue());
    }

    @Test
    public void sharedFieldsAreCopiedWithTheSameReference() {
        EntityA entityA = new EntityA();
        Date originalDate = new Date();
        entityA.setSharedProperty(originalDate);
        EntityA copy = new DeepCopy().copy(entityA);
        assertSame(originalDate, copy.getSharedProperty());
    }
View Full Code Here

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

        assertSame(originalDate, copy.getSharedProperty());
    }

    @Test
    public void sharedCollectionsAreCopiedWithTheSameReference() {
        EntityA entityA = new EntityA();
        List<String> originalList = Arrays.asList("bla");
        entityA.setSharedListProperty(originalList);
        EntityA copy = new DeepCopy().copy(entityA);
        assertSame(originalList, copy.getSharedListProperty());
    }
View Full Code Here

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

        assertSame(originalList, copy.getSharedListProperty());
    }

    @Test
    public void sharedCollectionElementsKeptTheReferences() {
        EntityA entityA = new EntityA();
        HashSet<Object> originalSet = new HashSet<Object>();
        originalSet.add(new Date());
        entityA.setSharedElementsProperty(originalSet);
        EntityA copy = new DeepCopy().copy(entityA);
        assertNotSame(originalSet, copy.getSharedElementsProperty());
        assertSame(originalSet.iterator().next(), copy
                .getSharedElementsProperty().iterator().next());
    }
View Full Code Here

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

                .getSharedElementsProperty().iterator().next());
    }

    @Test
    public void sharedKeyElementsKeepTheSameReferencesForTheKeys() {
        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.setSharedKeysMapProperty(originalMap);
        EntityA copy = new DeepCopy().copy(entityA);
        Map<Object, Object> sharedKeysMapProperty = copy
                .getSharedKeysMapProperty();
        assertSame(originalKey, sharedKeysMapProperty.keySet().iterator()
                .next());
        assertNotSame(originalValue, sharedKeysMapProperty.values().iterator()
                .next());
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.