private static void failNotEqual(
     @Nonnull String[][] actual, @Nonnull String[][] expected, @Nullable Description description) {
   String descriptionValue = description != null ? description.value() : null;
   String message = descriptionValue == null ? "" : String.format("[%s] ", descriptionValue);
   fail(
       message
           + String.format(
               "expected:<%s> but was<%s>", Arrays.format(expected), Arrays.format(actual)));
 }
 @Test
 public void testEndObject() throws Exception {
   JacksonParserWrapper parser = new JacksonParserWrapper(jsonFactory.createJsonParser("{}"));
   parser.startObject();
   parser.endObject();
   try {
     parser.endObject();
     fail("Where is the Exception");
   } catch (JsonParseException e) {
     assertThat(e.getMessage()).startsWith("Invalid token. Expected <END_OBJECT> but got <null>");
   }
 }
Ejemplo n.º 3
0
 private Option find(List<Option> options, String name) {
   final List<Option> match =
       options
           .stream()
           .filter(c -> c.getLongName().equalsIgnoreCase(name))
           .collect(Collectors.toList());
   if (match.isEmpty()) {
     fail(
         "Cannot find option '"
             + name
             + "' in "
             + options.stream().map(Option::getLongName).collect(Collectors.toList()));
   }
   return match.get(0);
 }