Ejemplo n.º 1
0
  @Test
  public void testSetStringMessageWithLocalizationIfNoTranslation() throws Exception {
    String expected = "Good morning";
    WelcomeMessage welcomeMessage = new WelcomeMessage();

    PropertiesReader.setStringMessageWithLocalization(welcomeMessage, "welcomeObj1", Locale.CHINA);
    String result = welcomeMessage.getHelloMessage();

    assertThat(result, is(expected));
  }
Ejemplo n.º 2
0
  @Test
  public void testSetStringMessageWithLocalizationRu() throws Exception {
    String expected = "Доброе утро";
    WelcomeMessage welcomeMessage = new WelcomeMessage();

    PropertiesReader.setStringMessageWithLocalization(
        welcomeMessage, "welcomeObj1", new Locale("ru"));
    String result = welcomeMessage.getHelloMessage();

    assertThat(result, is(expected));
  }
Ejemplo n.º 3
0
  @Test
  public void testInitFalse() throws IOException {

    List<WelcomeMessage> expected = new ArrayList<>(3);
    WelcomeMessage welcomeMessage1 = new WelcomeMessage(LocalTime.of(1, 0), LocalTime.of(12, 0));
    welcomeMessage1.setHelloMessage("Good morning");
    WelcomeMessage welcomeMessage2 = new WelcomeMessage(LocalTime.of(12, 0), LocalTime.of(19, 0));
    welcomeMessage2.setHelloMessage("Good day");
    WelcomeMessage welcomeMessage3 = new WelcomeMessage(LocalTime.of(19, 0), LocalTime.of(6, 0));
    welcomeMessage3.setHelloMessage("God evening");
    expected.add(welcomeMessage1);
    expected.add(welcomeMessage2);
    expected.add(welcomeMessage3);

    PropertiesReader prop = new PropertiesReader("projectTest.properties", Locale.ENGLISH);
    List<WelcomeMessage> result = prop.getWelcomeMessageList();

    assertThat(result, not(expected));
  }