JSONSerialization serialization = mock(JSONSerialization.class);
serializerBuilder = new RandomSerializer();
when(result.use(JSONSerialization.class)).thenReturn(serialization);
when(serialization.from(any())).thenReturn(serializerBuilder);
try {
factory.instanceFor(JSONSerialization.class, errors).from(new Object());
factory.instanceFor(JSONSerialization.class, errors).from(new Object()).include("abc");
factory.instanceFor(JSONSerialization.class, errors).from(new Object()).exclude("abc");