* @throws Exception 例外が発生した場合
*/
@Test
public void input() throws Exception {
TsvIoFactory<MockModel> factory = new TsvIoFactory<MockModel>(MockModel.class);
MockModel object = factory.createModelObject();
InputStream in = new ByteArrayInputStream(
"Hello\nWorld\nTSV\nINPUT\n".getBytes("UTF-8"));
LinkedList<String> expected = new LinkedList<String>();
Collections.addAll(expected, "Hello", "World", "TSV", "INPUT");
ModelInput<MockModel> modelIn = factory.createModelInput(in);
try {
while (modelIn.readTo(object)) {
assertThat(expected.isEmpty(), is(false));
object.assertValueIs(expected.removeFirst());
}
assertThat(expected.isEmpty(), is(true));
} finally {
modelIn.close();
}