Package com.netflix.zeno.testpojos

Examples of com.netflix.zeno.testpojos.TypeC


    @Test
    public void serializeObjectsWithNullReferences() throws Exception {
        serializationState = new FastBlobStateEngine(serializersFactory);

        cache("TypeC", new TypeC(null, null));

        serializeAndDeserializeSnapshot();

        final TypeC deserialized = (TypeC) getAll("TypeC").get(0);

        Assert.assertNull(deserialized.getTypeAMap());
        Assert.assertNull(deserialized.getTypeBs());
    }
View Full Code Here


    @Test
    public void serializeNestedObjects() throws Exception {
        serializationState = new FastBlobStateEngine(serializersFactory);

        cache("TypeC", new TypeC(
                typeAMap(),
                Arrays.asList(
                        new TypeB(3, "four"),
                        new TypeB(5, "six")
                        )
                ));

        serializeAndDeserializeSnapshot();

        final TypeC deserializedC = (TypeC) getAll("TypeC").get(0);

        Assert.assertEquals(2, deserializedC.getTypeAMap().size());
        Assert.assertEquals(12, deserializedC.getTypeAMap().get("ED").getVal1());
        Assert.assertEquals(34, deserializedC.getTypeAMap().get("ED").getVal2());
        Assert.assertEquals(56, deserializedC.getTypeAMap().get("BR").getVal1());
        Assert.assertEquals(78, deserializedC.getTypeAMap().get("BR").getVal2());
        Assert.assertEquals(2, deserializedC.getTypeBs().size());
        Assert.assertEquals(3, deserializedC.getTypeBs().get(0).getVal1());
        Assert.assertEquals("four", deserializedC.getTypeBs().get(0).getVal2());
        Assert.assertEquals(5, deserializedC.getTypeBs().get(1).getVal1());
        Assert.assertEquals("six", deserializedC.getTypeBs().get(1).getVal2());

        Assert.assertSame(deserializedC.getTypeAMap(), getAll(TypeCSerializer.MAP_SERIALIZER.getName()).get(0));
        Assert.assertSame(deserializedC.getTypeBs(), getAll(TypeCSerializer.LIST_SERIALIZER.getName()).get(0));
        Assert.assertTrue(getAll("TypeB").contains(deserializedC.getTypeBs().get(0)));
        Assert.assertTrue(getAll("TypeB").contains(deserializedC.getTypeBs().get(1)));
    }
View Full Code Here

        Assert.assertEquals(2, deserializedTypeA.getVal2());
    }

    @Test
    public void roundTripJson() throws IOException {
        TypeC originalTypeC = createTestTypeC();

        JsonSerializationFramework jsonFramework = new JsonSerializationFramework(typeCSerializerFactory);
        String json = jsonFramework.serializeAsJson("TypeC", createTestTypeC());

        TypeC deserializedTypeC = jsonFramework.deserializeJson("TypeC", json);

        Assert.assertEquals(originalTypeC, deserializedTypeC);
    }
View Full Code Here

        typeAMap.put("a34", new TypeA(3, 4));

        typeBs.add(new TypeB(5, "five"));
        typeBs.add(new TypeB(6, "six"));

        return new TypeC(typeAMap, typeBs);
    }
View Full Code Here

TOP

Related Classes of com.netflix.zeno.testpojos.TypeC

Copyright © 2018 www.massapicom. 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.