@@ -0,0 +1,2537 @@
+package org.modelmapper.bugs;%0A%0Aimport static org.testng.Assert.assertTrue;%0A%0Aimport java.util.EnumSet;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.modelmapper.AbstractTest;%0Aimport org.modelmapper.Converter;%0Aimport org.modelmapper.spi.MappingContext;%0Aimport org.testng.annotations.Test;%0A%0A/**%0A * https://github.com/jhalterman/modelmapper/issues/20%0A */%0A@Test%0Apublic class GH20 extends AbstractTest %7B%0A  public static class ServiceOperation %7B%0A    private String target;%0A    private Command cmd;%0A%0A    public String getTarget() %7B%0A      return target;%0A    %7D%0A%0A    public void setTarget(String target) %7B%0A      this.target = target;%0A    %7D%0A%0A    public Command getCmd() %7B%0A      return cmd;%0A    %7D%0A%0A    public void setCmd(Command cmd) %7B%0A      this.cmd = cmd;%0A    %7D%0A  %7D%0A%0A  public static class ServiceOperationDTO %7B%0A    private String target;%0A    private String cmdStr;%0A%0A    public String getTarget() %7B%0A      return target;%0A    %7D%0A%0A    public void setTarget(String target) %7B%0A      this.target = target;%0A    %7D%0A%0A    public String getCmd() %7B%0A      return cmdStr;%0A    %7D%0A%0A    public void setCmd(String cmdStr) %7B%0A      this.cmdStr = cmdStr;%0A    %7D%0A  %7D%0A%0A  public enum Command %7B%0A    Up, Down, Once, Pause, Cont, Hup, Alarm, Interrupt, Quit, Usr1(%221%22), Usr2(%222%22), Term, Kill, Exit, Status, Start, Stop, Restart, Shutdown, ForceStop(%0A        %22force-stop%22), ForceReload(%22force-reload%22), ForceRestart(%22force-restart%22), ForceShutdown(%0A        %22force-shutdown%22), Check, Invalid;%0A%0A    private static final Map%3CString, Command%3E lookup = new HashMap%3CString, Command%3E();%0A%0A    static %7B%0A      for (Command c : EnumSet.allOf(Command.class))%0A        lookup.put(c.toString(), c);%0A    %7D%0A%0A    Command() %7B%0A      this.value = this.name().toLowerCase();%0A    %7D%0A%0A    Command(String svCmd) %7B%0A      this.value = svCmd;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A      return value;%0A    %7D%0A%0A    public static Command fromString(String cmd) %7B%0A      return lookup.get(cmd);%0A    %7D%0A%0A    private final String value;%0A  %7D%0A%0A  public void test() %7B%0A    ServiceOperationDTO dto = new ServiceOperationDTO();%0A    dto.setCmd(%22force-stop%22);%0A    dto.setTarget(%22myService%22);%0A%0A    modelMapper.addConverter(new Converter%3CString, Command%3E() %7B%0A      public Command convert(MappingContext%3CString, Command%3E context) %7B%0A        String source = context.getSource();%0A        return source == null ? null : Command.fromString(source);%0A      %7D%0A    %7D);%0A%0A    ServiceOperation domainObj = modelMapper.map(dto, ServiceOperation.class);%0A    assertTrue(domainObj.getCmd() == Command.ForceStop);%0A  %7D%0A%7D%0A

test for issue #20