### Question:
ViewsHistory { public ViewsHistory() { previousViews = new Stack<ViewUpdate>(); nextViews = new Stack<ViewUpdate>(); } ViewsHistory(); Stack<ViewUpdate> getPreviousViews(); Stack<ViewUpdate> getNextViews(); void viewUpdated(Class viewClass, Object... args); ViewUpdate back(); ViewUpdate next(); void clear();  }### Answer:
@Test public void testViewsHistory() { ViewsHistory history = new ViewsHistory(); history.viewUpdated(View1.class, "arg1"); history.viewUpdated(View2.class, "arg1"); history.viewUpdated(View3.class, "arg1"); history.viewUpdated(View1.class, "arg2"); history.viewUpdated(View1.class, "arg3"); history.viewUpdated(View1.class, "arg3"); history.viewUpdated(View3.class, "arg4"); assertNull(history.next()); ViewUpdate viewUpdate = history.back(); assertEquals(viewUpdate.getViewClass(), View1.class); assertEquals(viewUpdate.getArgs()[0], "arg3"); viewUpdate = history.back(); assertEquals(viewUpdate.getViewClass(), View1.class); assertEquals(viewUpdate.getArgs()[0], "arg2"); viewUpdate = history.back(); assertEquals(viewUpdate.getViewClass(), View3.class); assertEquals(viewUpdate.getArgs()[0], "arg1"); viewUpdate = history.back(); assertEquals(viewUpdate.getViewClass(), View2.class); assertEquals(viewUpdate.getArgs()[0], "arg1"); viewUpdate = history.back(); assertEquals(viewUpdate.getViewClass(), View1.class); assertEquals(viewUpdate.getArgs()[0], "arg1"); assertNull(history.back()); viewUpdate = history.next(); assertEquals(viewUpdate.getViewClass(), View2.class); assertEquals(viewUpdate.getArgs()[0], "arg1"); viewUpdate = history.next(); assertEquals(viewUpdate.getViewClass(), View3.class); assertEquals(viewUpdate.getArgs()[0], "arg1"); viewUpdate = history.next(); assertEquals(viewUpdate.getViewClass(), View1.class); assertEquals(viewUpdate.getArgs()[0], "arg2"); viewUpdate = history.next(); assertEquals(viewUpdate.getViewClass(), View1.class); assertEquals(viewUpdate.getArgs()[0], "arg3"); viewUpdate = history.next(); assertEquals(viewUpdate.getViewClass(), View3.class); assertEquals(viewUpdate.getArgs()[0], "arg4"); assertNull(history.next()); }