@Test
    public void testRotation() throws IOException {
        File tmpDir = temporaryFolder.newFolder();

        ArchiverHandler a = new ArchiverHandler(tmpDir.getAbsolutePath(),
                                                msg[1].toString().length() + 1,
                                                "gzip");
        // log the same message 4 times
        for (int i = 0; i < 4; i++) {
            a.handle(msg[1]);
        }
        a.close();

        // we should now have 3 files
        String prefix = a.getPrefix(msg[1]);
        int msgCount = 0;
        for (int i = 0; i < 3; i++) {
            File f = new File(prefix + "-" + i);
            assertTrue(f.exists());

            // ensure there's the same log message in all files
            BufferedReader br = new BufferedReader(new FileReader(f));
            for (String line = br.readLine();
                 line != null;
                 line = br.readLine()) {
                assertTrue(msg[1].toString().equals((line + "\n")));
                msgCount++;
            }
            br.close();
        }
        assertEquals(4, msgCount);

        // make sure we have no more than 3 files
        assertTrue(! (new File(prefix + "-3").exists()));



    }
Make sure that the file is rotated after N bytes
logserver/src/test/java/com/yahoo/logserver/handlers/archive/ArchiverHandlerTestCase.java