use of com.github.noraui.model.ModelList in project NoraUi by NoraUi.
the class ArticleUT method checkgetModelListTest.
@Test
public void checkgetModelListTest() throws InstantiationException, IllegalAccessException {
// prepare mock
Article football = new Article();
football.setTitle("Football");
football.setText("Football is a family of team sports...");
football.setAuthor("wikipedia");
football.setNote(8);
Article judo = new Article();
judo.setTitle("Judo");
judo.setText("Judo was created as a physical, mental and moral pedagogy in Japan, in 1882, by Kanō Jigorō...");
judo.setAuthor("wikipedia");
judo.setNote(10);
Class<? extends ModelList> c = football.getModelList();
ModelList cl = c.newInstance();
cl.addModel(football);
cl.addModel(judo);
// run test
Assert.assertEquals("[{\"title\":\"Football\",\"text\":\"Football is a family of team sports...\",\"author\":\"wikipedia\",\"note\":8},{\"title\":\"Judo\",\"text\":\"Judo was created as a physical, mental and moral pedagogy in Japan, in 1882, by Kanō Jigorō...\",\"author\":\"wikipedia\",\"note\":10}]", cl.serialize());
}
Aggregations