DeserializesHandler implements StereotypeHandler { @SuppressWarnings("unchecked") public void handle(Class<?> type) { if (!Deserializer.class.isAssignableFrom(type)) { throw new IllegalArgumentException(type + " must implement Deserializer"); } if (BaseComponents.getDeserializers().contains(type)) { logger.debug("Ignoring default deserializer {}", type); return; } deserializers.register((Class<? extends Deserializer>) type); } DeserializesHandler(Deserializers deserializers); @SuppressWarnings("unchecked") void handle(Class<?> type); Class<? extends Annotation> stereotype();  }
@Test(expected=IllegalArgumentException.class) public void shouldThrowExceptionWhenTypeIsNotADeserializer() throws Exception { handler.handle(NotADeserializer.class); }
@Test public void shouldRegisterTypesOnDeserializers() throws Exception { handler.handle(MyDeserializer.class); verify(deserializers).register(MyDeserializer.class); }