Package batch.internal.support

Examples of batch.internal.support.ResourceLineReader


/**
*/
public class ResourceLineReaderTests extends TestCase {

  public void testBadResource() throws Exception {
    ResourceLineReader reader = new ResourceLineReader(new InputStreamResource(new InputStream() {
      public int read() throws IOException {
        throw new IOException("Foo");
      }
    }));
    try {
      reader.read();
      fail("Expected InvalidBatchException");
    } catch (InvalidBatchException e) {
      // expected
      assertTrue(e.getMessage().startsWith("Unable to read"));
    }
View Full Code Here


    }
  }

  public void testRead() throws Exception {
    Resource resource = new InputStreamResource(new ByteArrayInputStream("a,b,c\n1,2,3".getBytes()));
    ResourceLineReader reader = new ResourceLineReader(resource);
    int count = 0;
    String line;
    while ((line = (String) reader.read()) != null) {
      count++;
      assertNotNull(line);
    }

    assertEquals(2, count);
View Full Code Here

TOP

Related Classes of batch.internal.support.ResourceLineReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.