@Test
  public void testGetMostRecentEvent() {

    EventManager manager = new EventManagerImpl(2);

    Event e1 = new Event("1", "Event1", Category.INFO, 0);
    Event e2 = new Event("1", "Event2", Category.INFO, 1);

    manager.addEvent(e1);
    manager.addEvent(e2);

    // assert newest to oldest
    assertEquals(e2, manager.getMostRecentEvent("1"));
  }
  @Test
  public void testAddEventExceedsHistorySize() {

    EventManager manager = new EventManagerImpl(1);

    Event e1 = new Event("1", "Event1", Category.INFO, 0);
    Event e2 = new Event("1", "Event2", Category.INFO, 1);

    manager.addEvent(e1);
    manager.addEvent(e2);

    List<Event> events = manager.getEvents("1");

    // assert oldest evicted
    assertEquals(Arrays.asList(e2), events);
  }
  @Test
  public void testGetEvents() {

    EventManager manager = new EventManagerImpl(2);

    Event e1 = new Event("1", "Event1", Category.INFO, 0);
    Event e2 = new Event("1", "Event2", Category.INFO, 1);

    manager.addEvent(e1);
    manager.addEvent(e2);

    List<Event> events = manager.getEvents("1");

    // assert newest to oldest
    assertEquals(Arrays.asList(e2, e1), events);
  }
  @Test
  public void testClearHistory() {

    EventManager manager = new EventManagerImpl(1);

    Event e1 = new Event("1", "Event1", Category.INFO, 0);
    Event e2 = new Event("1", "Event2", Category.INFO, 1);

    manager.addEvent(e1);
    manager.addEvent(e2);

    manager.clearEventHistory("1");

    // assert oldest evicted
    assertTrue(manager.getEvents("1").isEmpty());
  }
 @Test
 public void testGetMostRecentEventUnknownSource() {
   EventManager manager = new EventManagerImpl(1);
   assertNull(manager.getMostRecentEvent("unknown value"));
 }
 @Test
 public void testGetEventsUnknownSource() {
   EventManager manager = new EventManagerImpl(1);
   assertEquals(Collections.EMPTY_LIST, manager.getEvents("unknown value"));
 }