Exemplo n.º 1
0
 @Override
 public String toString() {
   final TokenBuilder tb = new TokenBuilder().add(var.toString()).add(' ').add(ASSIGN);
   tb.add(' ').add(expr.toString());
   if (coll != null) tb.add(' ').add(COLLATION).add(" \"").add(coll.uri()).add('"');
   return tb.toString();
 }
Exemplo n.º 2
0
 @Override
 public String getMessage() {
   final TokenBuilder tb = new TokenBuilder();
   if (info != null) tb.add(STOPPED_AT).add(info.toString()).add(COL).add(NL);
   final byte[] code = name.local();
   if (code.length != 0) tb.add('[').add(name.prefixId(QueryText.ERROR_URI)).add("] ");
   tb.add(getLocalizedMessage());
   if (!stack.isEmpty()) {
     tb.add(NL).add(NL).add(STACK_TRACE).add(COL);
     for (final InputInfo ii : stack) tb.add(NL).add(LI).add(ii.toString());
   }
   return tb.toString();
 }
Exemplo n.º 3
0
  /**
   * Compares results.
   *
   * @param expected expected result
   * @param returned returned result
   * @throws Exception exception
   */
  private static void compare(final ItemList expected, final ItemList returned) throws Exception {

    // Compare response with expected result
    assertEquals("Different number of results", expected.size(), returned.size());

    final long es = expected.size();
    for (int e = 0; e < es; e++) {
      final Item exp = expected.get(e), ret = returned.get(e);
      if (!new DeepEqual().equal(exp, ret)) {
        final TokenBuilder tb = new TokenBuilder("Result ").addLong(e).add(" differs:\nReturned: ");
        tb.addExt(ret.serialize()).add("\nExpected: ").addExt(exp.serialize());
        fail(tb.toString());
      }
    }
  }