ResourceContext { public void changeResource(Resource resource) { Resource previousResource = getResource(); if (previousResource == null || !previousResource.equals(resource)) { resetIndex(); setHasChanged(true); setResource(resource); } } ResourceContext(ExecutionContext executionContext, String keyPrefix); void changeResource(Resource resource); Resource consumeResource(); boolean hasChanged(); boolean containsResource(); Resource getResource(); void setResource(Resource resource); void setCurrentIndex(int index); void incrementIndex(); int getCurrentIndex(); ExecutionContext getExecutionContext(); void setRowsToSkip(int rowsToSkip); void clear(); static final String RESOURCE_KEY; static final String HAS_CHANGED_KEY; static final String CURRENT_INDEX_KEY; }
@Test public void testChangeResource() throws Exception { context.changeResource(new FileSystemResource("./")); Assert.assertTrue(context.hasChanged()); Assert.assertTrue(context.containsResource()); }