コード例 #1
0
ファイル: Failures.java プロジェクト: akihyro/assertj-core
 public AssertionError failureIfErrorMessageIsOverridden(AssertionInfo info) {
   String overridingErrorMessage = info.overridingErrorMessage();
   return isNullOrEmpty(overridingErrorMessage)
       ? null
       : failure(
           MessageFormatter.instance()
               .format(info.description(), info.representation(), overridingErrorMessage));
 }
コード例 #2
0
 @Test
 public void should_create_error_with_StandardRepresentation() {
   Description description = new TestDescription("Test");
   String formattedMessage = "[Test] Hello Yoda";
   when(formatter.format(
           eq(description), any(StandardRepresentation.class), eq("Hello %s"), eq("Yoda")))
       .thenReturn(formattedMessage);
   assertThat(factory.create(description)).isEqualTo(formattedMessage);
 }
コード例 #3
0
 @Test
 public void should_implement_toString() {
   Description description = new TestDescription("Test");
   Representation representation = new StandardRepresentation();
   String formattedMessage = "[Test] Hello Yoda";
   when(formatter.format(description, representation, "Hello %s", "Yoda"))
       .thenReturn(formattedMessage);
   assertThat(factory.create(description, representation)).isEqualTo(formattedMessage);
 }