Serializer { public SerializationStrategy.Factory serializationStrategyFactory() { return mFactory; } Serializer(SerializationStrategy.Factory factory); SerializationStrategy.Factory serializationStrategyFactory(); SerializationStrategy<T> strategy(Class<T> type);  }
@Test public void shouldSuccessfullySerializeToJsonStrings() { assertTrue(mSerializer .serializationStrategyFactory() instanceof GsonSerializationStrategyFactory); String jsonString = getJsonStrings(); assertNotNull(jsonString); assertEquals( "[{\"name\":\"Silverbird\",\"locationName\":\"Accra Mall\",\"location\":" + "{\"latitude\":0.0,\"longitude\":0.0}}]", jsonString); }
@Test public void shouldUseMoshiToSerialize() { MoshiSerializationStrategyFactory factory = MoshiSerializationStrategyFactory.create(); mSerializer = new Serializer.Builder() .setSerializationStrategyFactory(factory) .build(); assertTrue(mSerializer .serializationStrategyFactory() instanceof MoshiSerializationStrategyFactory); String jsonString = getJsonString(); assertNotNull(jsonString); assertEquals( "{\"location\":{\"latitude\":0.0,\"longitude\":0.0},\"locationName\":" + "\"Accra Mall\",\"name\":\"Silverbird\"}", jsonString); }
@Test public void shouldSuccessfullySerializeToJsonString() { assertTrue(mSerializer .serializationStrategyFactory() instanceof GsonSerializationStrategyFactory); String jsonString = getJsonString(); assertNotNull(jsonString); assertEquals( "{\"name\":\"Silverbird\",\"locationName\":\"Accra Mall\",\"location\":" + "{\"latitude\":0.0,\"longitude\":0.0}}", jsonString); }