DefaultDeserializers implements Deserializers { public void register(Class<? extends Deserializer> type) { if (!type.isAnnotationPresent(Deserializes.class)) { throw new IllegalArgumentException("You must annotate your deserializers with @Deserializes"); } String[] contentTypes = type.getAnnotation(Deserializes.class).value(); for (String contentType : contentTypes) { deserializers.put(contentType, type); } } DefaultDeserializers(); Deserializer deserializerFor(String contentType, Container container); void register(Class<? extends Deserializer> type);  }
@Test(expected=IllegalArgumentException.class) public void allDeserializersMustBeAnnotatedWithDeserializes() throws Exception { deserializers.register(NotAnnotatedDeserializer.class); }