Example #1
0
  public void testToStringList() {
    List<String> expected =
        Arrays.asList(
            getClass().getPackage().getName(), getClass().getSimpleName(), "testToStringList");
    StringBuilder sb = new StringBuilder();
    for (String value : expected) {
      sb.append(value).append('\0');
    }
    sb.append('\0');

    List<String> actual = Native.toStringList(sb.toString().toCharArray());
    assertEquals("Mismatched result size", expected.size(), actual.size());
    for (int index = 0; index < expected.size(); index++) {
      String expValue = expected.get(index);
      String actValue = actual.get(index);
      assertEquals("Mismatched value at index #" + index, expValue, actValue);
    }
  }