コード例 #1
0
  @Test
  public void testYesNoValueConversion() {
    Assert.assertTrue(yesNoConverter.convertToModel("yes", Boolean.class, null));
    Assert.assertFalse(yesNoConverter.convertToModel("no", Boolean.class, null));

    Assert.assertEquals("yes", yesNoConverter.convertToPresentation(true, String.class, null));
    Assert.assertEquals("no", yesNoConverter.convertToPresentation(false, String.class, null));
  }
コード例 #2
0
  @Test
  public void testLocale() {
    Assert.assertEquals(
        "May 18, 2033", localeConverter.convertToPresentation(true, String.class, Locale.US));
    Assert.assertEquals(
        "January 24, 2065", localeConverter.convertToPresentation(false, String.class, Locale.US));

    Assert.assertEquals(
        "18. Mai 2033", localeConverter.convertToPresentation(true, String.class, Locale.GERMANY));
    Assert.assertEquals(
        "24. Januar 2065",
        localeConverter.convertToPresentation(false, String.class, Locale.GERMANY));
  }
コード例 #3
0
 @Test
 public void testEmptyStringConversion() {
   Assert.assertEquals(null, converter.convertToModel("", Boolean.class, null));
 }
コード例 #4
0
 @Test
 public void testValueConversion() {
   Assert.assertTrue(converter.convertToModel("true", Boolean.class, null));
   Assert.assertFalse(converter.convertToModel("false", Boolean.class, null));
 }
コード例 #5
0
 @Test
 public void testNullConversion() {
   Assert.assertEquals(null, converter.convertToModel(null, Boolean.class, null));
 }