### Question:
DoubleNameResolver { public String resolveDoubleName(AnnotationDetails details) { return resolveDoubleName(details, NO_FIELD); }  String resolveDoubleName(AnnotationDetails details); String resolveDoubleName(AnnotationDetails details, @Nullable String fieldName);  }### Answer:
@Test public void should_use_declared_double_name() { final String mockName = "mock"; final AnnotationDetails detailsWithName = annotationDetails(mockName); assertEquals( mockName, nameResolver.resolveDoubleName(detailsWithName)); }
@Test public void should_use_declared_double_class_to_generate_double_name() { final AnnotationDetails detailsWithClass = annotationDetails(DoubleDefinition.class); assertEquals( nameResolver.resolveDoubleName(detailsWithClass), "doubleDefinition"); }
@Test public void should_use_field_name_to_generate_double_name() { final String fieldName = "mockedField"; final AnnotationDetails emptyDetails = annotationDetails(); assertEquals( fieldName, nameResolver.resolveDoubleName(emptyDetails, fieldName)); }
@Test public void should_fail_when_can_not_generate_name() { try { nameResolver.resolveDoubleName(annotationDetails()); fail("should fail"); } catch (IllegalStateException ex) { assertEquals( "Can not generate double name", ex.getMessage()); } }