final File logFile = new File(inputDir, "test");
Files.write("1\n2\n3\n", logFile, Charsets.UTF_8);
scanner.forceInput(logFile, 2);
SpoutState.recordCurrentState(emptyAcks, scanner, new FakeParser(), statusFile);
SpoutState rs = SpoutState.fromString(Files.toString(statusFile, Charsets.UTF_8));
assertEquals(0, rs.getOldFiles().size());
assertEquals(1, rs.getOffsets().size());
Map.Entry<File, Long> entry = rs.getOffsets().entrySet().iterator().next();
assertEquals(10247, (long) entry.getValue());
assertEquals("test", entry.getKey().getName());
assertEquals(".*\\.log", rs.getFilePattern().toString());
Queue<PendingMessage> q = Lists.newLinkedList();
DirectoryScanner s2 = SpoutState.restoreState(q, statusFile);
assertEquals(1, q.size());
assertEquals(0, s2.getOldFiles().size());