@KOTest public void loadAndParsePlainTextOnArray() throws Exception {
if (js == null) {
url = Utils.prepareURL(
JSONTest.class, "[ {'firstName': 'Sitar', 'sex': 'MALE'} ]",
"text/plain"
);
js = Models.bind(new JSONik(), ctx = newContext());
js.applyBindings();
js.setFetched(null);
js.fetchPlain(url);
}
String s = js.getFetchedResponse();
if (s == null) {
throw new InterruptedException();
}
assertTrue(s.contains("Sitar"), "The text contains Sitar value: " + s);
assertTrue(s.contains("MALE"), "The text contains MALE value: " + s);
Person p = Models.parse(ctx, Person.class, new ByteArrayInputStream(s.getBytes()));
assertEquals("Sitar", p.getFirstName(), "Expecting Sitar: " + p.getFirstName());
assertEquals(Sex.MALE, p.getSex(), "Expecting MALE: " + p.getSex());
assertEquals(ctx, onCallback, "Same context");
}