@Test
public void testPacking_notfull() throws Exception {

    List<Event> events = new LinkedList<>();
    for (int i = 0; i < PacketFactory.PAGE_SIZE * 2 - 2; i++) {
        events.add(new Event("?eve" + i));
    }
    PacketFactory factory = new PacketFactory("http://example.com/");
    List<Packet> packets = factory.buildPackets(events);
    Packet first = packets.get(0);
    assertEquals(PacketFactory.PAGE_SIZE, first.getEventCount());
    assertNotNull(first.getPostData());
    assertTrue(first.getPostData().getJSONArray("requests").getString(0).endsWith("?eve0"));
    Packet second = packets.get(1);
    assertEquals(PacketFactory.PAGE_SIZE - 2, second.getEventCount());
    assertNotNull(second.getPostData());
}