@Test public void shouldBuildDefaultConfigurationIfAnnotationOrAnnotatedValuesNotPresent() { final AnnotationBuilder builderNotAnnotated = new NeedleAnnotationBuilder(NotAnnotated.class); assertThatConfigurationIs( builderNotAnnotated.buildConfiguration(), new MostUsefulConfiguration()); final AnnotationBuilder builderAnnotatedWithoutModules = new NeedleAnnotationBuilder(AnnotatedWithoutInjectors.class); assertThatConfigurationIs( builderAnnotatedWithoutModules.buildConfiguration(), new MostUsefulConfiguration()); }
@Test public void shouldBuildCandidateStepsFromAnnotationsUsingNeedle() { final AnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedUsingNeedle.class); final Configuration configuration = builderAnnotated.buildConfiguration(); assertTrue(builderAnnotated.buildCandidateSteps(configuration).isEmpty()); }
@Test public void shouldBuildCandidateStepsFromAnnotationsUsingStepsAndGuiceAndConverters() { final AnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedUsingConfigureAndNeedleConverters.class); final Configuration configuration = builderAnnotated.buildConfiguration(); assertThatStepsInstancesAre( builderAnnotated.buildCandidateSteps(configuration), FooSteps.class); }
@Test public void shouldBuildConfigurationFromAnnotationsUsingConfigureAndGuiceConverters() { final AnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedUsingConfigureAndNeedleConverters.class); final Configuration configuration = builderAnnotated.buildConfiguration(); assertThatCustomObjectIsConverted(configuration.parameterConverters()); assertThatDateIsConvertedWithFormat( configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd")); assertThatExamplesTableIsConverted(configuration.parameterConverters()); }