@Test public void checkStatusFileCorrectlyUpdated() throws Exception { File file = File.createTempFile("statusFileName", ".txt"); when(context.getString("status.file.path", "/var/lib/flume")).thenReturn(file.getParent()); when(context.getString("status.file.name")).thenReturn(file.getName()); SQLSourceHelper sqlSourceHelper = new SQLSourceHelper(context, "Source Name"); sqlSourceHelper.setCurrentIndex(10); sqlSourceHelper.updateStatusFile(); SQLSourceHelper sqlSourceHelper2 = new SQLSourceHelper(context, "Source Name"); assertEquals(10L, sqlSourceHelper2.getCurrentIndex()); }
@Test public void setCurrentIndex() { SQLSourceHelper sqlSourceHelper = new SQLSourceHelper(context, "Source Name"); sqlSourceHelper.setCurrentIndex(10); assertEquals(10, sqlSourceHelper.getCurrentIndex()); }