use of org.mockito.internal.reporting.SmartPrinter in project mockito by mockito.
the class MissingInvocationChecker method checkMissingInvocation.
public static void checkMissingInvocation(List<Invocation> invocations, MatchableInvocation wanted) {
List<Invocation> actualInvocations = findInvocations(invocations, wanted);
if (!actualInvocations.isEmpty()) {
return;
}
Invocation similar = findSimilarInvocation(invocations, wanted);
if (similar == null) {
throw wantedButNotInvoked(wanted, invocations);
}
Integer[] indexesOfSuspiciousArgs = getSuspiciouslyNotMatchingArgsIndexes(wanted.getMatchers(), similar.getArguments());
SmartPrinter smartPrinter = new SmartPrinter(wanted, similar, indexesOfSuspiciousArgs);
throw argumentsAreDifferent(smartPrinter.getWanted(), smartPrinter.getActual(), similar.getLocation());
}
use of org.mockito.internal.reporting.SmartPrinter in project mockito by mockito.
the class SmartPrinterTest method shouldPrintBothInMultilinesWhenFirstIsMulti.
@Test
public void shouldPrintBothInMultilinesWhenFirstIsMulti() {
//when
SmartPrinter printer = new SmartPrinter(multi, shortie.getInvocation());
//then
assertThat(printer.getWanted().toString()).contains("\n");
assertThat(printer.getActual().toString()).contains("\n");
}
use of org.mockito.internal.reporting.SmartPrinter in project mockito by mockito.
the class SmartPrinterTest method shouldPrintBothInSingleLineWhenBothAreShort.
@Test
public void shouldPrintBothInSingleLineWhenBothAreShort() {
//when
SmartPrinter printer = new SmartPrinter(shortie, shortie.getInvocation());
//then
assertThat(printer.getWanted().toString()).doesNotContain("\n");
assertThat(printer.getActual().toString()).doesNotContain("\n");
}
use of org.mockito.internal.reporting.SmartPrinter in project mockito by mockito.
the class SmartPrinterTest method shouldPrintBothInMultilinesWhenBothAreMulti.
@Test
public void shouldPrintBothInMultilinesWhenBothAreMulti() {
//when
SmartPrinter printer = new SmartPrinter(multi, multi.getInvocation());
//then
assertThat(printer.getWanted().toString()).contains("\n");
assertThat(printer.getActual().toString()).contains("\n");
}
use of org.mockito.internal.reporting.SmartPrinter in project mockito by mockito.
the class SmartPrinterTest method shouldPrintBothInMultilinesWhenSecondIsMulti.
@Test
public void shouldPrintBothInMultilinesWhenSecondIsMulti() {
//when
SmartPrinter printer = new SmartPrinter(shortie, multi.getInvocation());
//then
assertThat(printer.getWanted().toString()).contains("\n");
assertThat(printer.getActual().toString()).contains("\n");
}
Aggregations