public void testAllEventClassesHaveConversionStaticMethod() throws Exception { for (EventType eventType : EventType.values()) { if (eventType == EventType.UNKNOWN) { continue; } try { Method method = eventType.getClazz().getDeclaredMethod("as", Event.class); assertEquals(eventType.getClazz(), method.getReturnType()); } catch (NoSuchMethodException e) { fail(eventType.getClazz().getName() + " should implement a no-arg constructor that will " + "be used for deserialization."); } } }
public void testAllEventClassesHaveTheAppropriateConstructor() throws Exception { for (EventType eventType : EventType.values()) { if (eventType == EventType.UNKNOWN) { continue; } try { Class<? extends Event> clazz = eventType.getClazz(); clazz.getDeclaredConstructor(); } catch (NoSuchMethodException e) { fail(eventType.getClazz().getName() + " should implement a no-arg constructor that will " + "be used for deserialization."); } } }
public void testAllEventClassesHaveTheAppropriateConstructor() throws Exception { for (EventType eventType : EventType.values()) { if (eventType == EventType.UNKNOWN) { continue; } try { Class<? extends Event> clazz = eventType.getClazz(); clazz.getDeclaredConstructor(); } catch (NoSuchMethodException e) { fail(eventType.getClazz().getName() + " should implement a no-arg constructor that will " + "be used for deserialization."); } } }
public void testAllEventClassesHaveConversionStaticMethod() throws Exception { for (EventType eventType : EventType.values()) { if (eventType == EventType.UNKNOWN) { continue; } try { Method method = eventType.getClazz().getDeclaredMethod("as", Event.class); assertEquals(eventType.getClazz(), method.getReturnType()); } catch (NoSuchMethodException e) { fail(eventType.getClazz().getName() + " should implement a no-arg constructor that will " + "be used for deserialization."); } } }
Class<? extends Event> clazz = type.getClazz(); Constructor<? extends Event> ctor; try {