### Question:
PythianStateDescriptionFactory { public PythianStateDescription createDescription(Class<? extends PythianState> clazz) { checkArgument(clazz != null, "PythianState class is mandatory"); Documentation documentation = clazz.getAnnotation(Documentation.class); checkArgument(documentation != null, "No documentation found for " + clazz + " but documentation is mandatory!"); PythianStateDescription description = new PythianStateDescription(clazz, documentation.name(), documentation.description()); description.addProperties(propertyDescriptionFactory.createPropertyDescriptions(clazz)); return description; }  PythianStateDescription createDescription(Class<? extends PythianState> clazz);  }### Answer:
@Test public void should_create_description() { @Documentation(name = "Name", description = "Description") class TestState implements PythianState { public StateFactory createStateFactory() { return null; } } List<PropertyDescription> expectedProperties = new ArrayList<>(); given(propertyDescriptionFactory.createPropertyDescriptions(TestState.class)).willReturn(expectedProperties); PythianStateDescription description = factory.createDescription(TestState.class); assertThat(description.getName()).isEqualTo("Name"); assertThat(description.getDescription()).isEqualTo("Description"); assertThat(description.getProperties()).isEqualTo(expectedProperties); assertThat(description.getClazz()).isEqualTo(TestState.class); }
@Test(expected = IllegalArgumentException.class) public void should_fail_without_documentation() { class TestState implements PythianState { public StateFactory createStateFactory() { return null; } } factory.createDescription(TestState.class); }