コード例 #1
0
 @Test
 public void messageProvider() {
   assertEquals(TEST_MSG_EN, TestMessages.P0_MSG.getText());
   assertEquals(TEST_TTL_EN, TestMessages.P0_TTL.getText());
   assertEquals(TEST_MSG_FR, TestMessages.P0_MSG.getText(Locale.FRENCH));
   assertEquals(TEST_TTL_FR, TestMessages.P0_TTL.getText(Locale.FRENCH));
 }
コード例 #2
0
  @Test
  public void loggerProxy() {
    TestMessages.P0_MSG.error(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.ERROR, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);
    TestMessages.P0_MSG.error(TEST_CATEGORY);
    assertSingleEvent(Level.ERROR, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);

    TestMessages.P0_TTL.error(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.ERROR, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);
    TestMessages.P0_TTL.error(TEST_CATEGORY);
    assertSingleEvent(Level.ERROR, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);

    TestMessages.P0_MSG.warn(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.WARN, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);
    TestMessages.P0_MSG.warn(TEST_CATEGORY);
    assertSingleEvent(Level.WARN, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);

    TestMessages.P0_TTL.warn(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.WARN, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);
    TestMessages.P0_TTL.warn(TEST_CATEGORY);
    assertSingleEvent(Level.WARN, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);

    TestMessages.P0_MSG.info(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.INFO, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);
    TestMessages.P0_MSG.info(TEST_CATEGORY);
    assertSingleEvent(Level.INFO, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);

    TestMessages.P0_TTL.info(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.INFO, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);
    TestMessages.P0_TTL.info(TEST_CATEGORY);
    assertSingleEvent(Level.INFO, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);

    TestMessages.P0_MSG.debug(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.DEBUG, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);
    TestMessages.P0_MSG.debug(TEST_CATEGORY);
    assertSingleEvent(Level.DEBUG, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);

    TestMessages.P0_TTL.debug(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.DEBUG, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);
    TestMessages.P0_TTL.debug(TEST_CATEGORY);
    assertSingleEvent(Level.DEBUG, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);

    TestMessages.P0_MSG.trace(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.TRACE, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);
    TestMessages.P0_MSG.trace(TEST_CATEGORY);
    assertSingleEvent(Level.TRACE, TEST_CATEGORY, TEST_MSG_EN, TEST_LOCATION);

    TestMessages.P0_TTL.trace(TEST_CATEGORY, TEST_THROWABLE);
    assertSingleEvent(Level.TRACE, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);
    TestMessages.P0_TTL.trace(TEST_CATEGORY);
    assertSingleEvent(Level.TRACE, TEST_CATEGORY, TEST_TTL_EN, TEST_LOCATION);
  }
コード例 #3
0
  @Test
  public void bound() {
    boundTests0P(
        TestMessages.P0_MSG, TestMessages.P0_MSG_COPY,
        TestMessages.P0_TTL, TestMessages.P0_TTL_COPY);
    I18NBoundMessage0P msg = new I18NBoundMessage0P(TestMessages.P0_MSG);
    I18NBoundMessage0P ttl = new I18NBoundMessage0P(TestMessages.P0_TTL);
    boundTests0P(
        msg, new I18NBoundMessage0P(TestMessages.P0_MSG),
        ttl, new I18NBoundMessage0P(TestMessages.P0_TTL));

    assertFalse(TestMessages.P0_MSG.equals(msg));
    assertFalse(msg.equals(TestMessages.P0_MSG));
    assertFalse(TestMessages.P0_TTL.equals(ttl));
    assertFalse(ttl.equals(TestMessages.P0_TTL));

    castOverride(msg.getMessage());
  }