@Test public void shouldBuildStepsList() { final AnnotationBuilder builderAnnotated = new NeedleAnnotationBuilder(AnnotatedMultipleSteps.class); final List<CandidateSteps> actual = builderAnnotated.buildCandidateSteps(); assertThatStepsInstancesAre(actual, FooStepsWithDependency.class, FooSteps.class); }
@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 shouldBuildEmptyStepsListIfAnnotationOrAnnotatedValuesNotPresent() { final AnnotationBuilder builderNotAnnotated = new NeedleAnnotationBuilder(NotAnnotated.class); assertThatStepsInstancesAre(builderNotAnnotated.buildCandidateSteps()); final AnnotationBuilder builderAnnotatedWithoutLocations = new NeedleAnnotationBuilder(AnnotatedWithoutInjectors.class); assertThatStepsInstancesAre(builderAnnotatedWithoutLocations.buildCandidateSteps()); }
@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 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()); }