Package org.modelmapper.spi

Examples of org.modelmapper.spi.ConstantMapping


      protected void configure() {
        when(CONDITION).using(UPPERCASE_CONVERTER).map().setEmployerName("joe");
      }
    }));

    ConstantMapping employer = (ConstantMapping) mappings.get("setEmployerName");
    assertEquals(employer.getCondition(), CONDITION);
    assertEquals(employer.getConverter(), UPPERCASE_CONVERTER);
    assertEquals(employer.getConstant(), "joe");
  }
View Full Code Here


        map().setSurName("jones");
      }
    }));

    PropertyMapping employer = (PropertyMapping) mappings.get("setEmployerName");
    ConstantMapping surName = (ConstantMapping) mappings.get("setSurName");
    assertEquals(employer.getLastSourceProperty().getMember().getName(), "getEmployer");
    assertEquals(employer.getLastDestinationProperty().getMember().getName(), "setEmployerName");
    assertEquals(surName.getConstant(), "jones");
    assertEquals(surName.getLastDestinationProperty().getMember().getName(), "setSurName");
  }
View Full Code Here

      protected void configure() {
        using(UPPERCASE_CONVERTER).map().setEmployerName("joe");
      }
    }));

    ConstantMapping employer = (ConstantMapping) mappings.get("setEmployerName");
    assertEquals(employer.getConverter(), UPPERCASE_CONVERTER);
    assertEquals(employer.getConstant(), "joe");
  }
View Full Code Here

        when(CONDITION).skip().setEmployerName(null);
        when(CONDITION).map().setSurName("smith");
      }
    }));

    ConstantMapping employer = (ConstantMapping) mappings.get("setEmployerName");
    assertEquals(employer.getCondition(), CONDITION);
    assertTrue(employer.isSkipped());
    assertEquals(employer.getConstant(), null);

    ConstantMapping surName = (ConstantMapping) mappings.get("setSurName");
    assertEquals(surName.getCondition(), CONDITION);
    assertFalse(surName.isSkipped());
    assertEquals(surName.getConstant(), "smith");
  }
View Full Code Here

      }
    });

    assertEquals(personMap.getMappings().size(), 1);
    Map<String, Mapping> mappings = Mappings.groupByLastMemberName(personMap.getMappings());
    ConstantMapping firstName = (ConstantMapping) mappings.get("setFirstName");
    assertEquals(firstName.getConstant(), "bob");
  }
View Full Code Here

        map().setSurName("smith");
      }
    });

    Map<String, Mapping> mappings = Mappings.groupByLastMemberName(personMap.getMappings());
    ConstantMapping surName = (ConstantMapping) mappings.get("setSurName");
    assertEquals(surName.getConstant(), "smith");
  }
View Full Code Here

TOP

Related Classes of org.modelmapper.spi.ConstantMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.