ByteArrayInputStream data = new ByteArrayInputStream("foobarbaz".getBytes());
Session session = mock(Session.class);
SessionFactory factory = mock(SessionFactory.class);
when(factory.getSession()).thenReturn(session);
when(session.readRaw("foo.txt")).thenReturn(data);
when(session.finalizeRaw()).thenReturn(true);
StepExecution stepExecution = new StepExecution("foo", null);
ExecutionContext stepExecutionContext = new ExecutionContext();
stepExecutionContext.putString("filePath", "foo.txt");
stepExecution.setExecutionContext(stepExecutionContext);