@Test
  public void shouldAcceptOnlyWhenCreateMethodDefined() {
    directive.setCreateMethod("a");
    assertTrue(byCreateMethod.isApplicable(directive));

    directive.setCreateMethod("");
    assertFalse(byCreateMethod.isApplicable(directive));

    directive.setCreateMethod(null);
    assertFalse(byCreateMethod.isApplicable(directive));
  }
 @Test(expected = MappingException.class)
 public void shouldFailWithNoSuchMethod() {
   directive.setTargetClass(SelfFactory.class);
   directive.setCreateMethod("wrong");
   byCreateMethod.create(directive);
   fail();
 }
 @Test
 public void shouldUseFullyQualifiedStaticCreateMethod() {
   directive.setTargetClass(String.class);
   directive.setCreateMethod(
       "org.dozer.factory.ConstructionStrategiesTest$ExternalFactory.create");
   String result = (String) byCreateMethod.create(directive);
   assertEquals("hello", result);
 }
  @Test
  public void shouldUseStaticCreateMethod() {
    directive.setTargetClass(SelfFactory.class);
    directive.setCreateMethod("create");
    SelfFactory result = (SelfFactory) byCreateMethod.create(directive);

    assertNotNull(result);
    assertEquals("a", result.getName());
  }