### Question:
HistoryManagerImpl implements HistoryManager { @Override public void setHistorySize(int size) { if(size < 1) { throw new IllegalArgumentException("History max size value invalid: " + size); } if(size > 50) { LOG.info("History size is configured to greater than 50! Ensure you have enough memory!!"); } if(maxSize == size) { return; } if(maxSize > size) { if(cursor >= size) { cursor = size - 1; } if(data.size() > size) { final int diff = data.size() - size; for(int i=0; i<diff; i++) { data.removeLast(); } } } maxSize = size; updateOptions(); }  @Override int getHistorySize(); @Override void setHistorySize(int size); @Override void add(Request request); @Override boolean isOldest(); @Override boolean isMostRecent(); @Override Request back(); @Override Request forward(); @Override Request current(); @Override Request lastRequest(); @Override void clear(); @Override boolean isEmpty(); int size(); int cursor(); @Override void save(File file); @Override void load(File file); @Override String toString();  }### Answer:
@Test public void testSetHistorySize() throws Exception { System.out.println("setHistorySize"); HistoryManagerImpl instance = new HistoryManagerImpl(); instance.setHistorySize(HistoryManager.DEFAULT_HISTORY_SIZE); for(int i=0; i<10; i++) { RequestBean request = new RequestBean(); request.setUrl(new URL("http: instance.add(request); } instance.setHistorySize(5); assertEquals(5, instance.size()); }