### Question:
WaldWolfowitz { public static boolean test(FlatDataCollection flatDataCollection, double aLevel) { int U=0; Map<Object, Integer> Ni = new HashMap<>(); Object previousValue=null; for(Object x : flatDataCollection) { if(previousValue!=null && !previousValue.equals(x)) { ++U; } previousValue=x; if(Ni.containsKey(x)==false) { Ni.put(x, 1); } else { Ni.put(x, Ni.get(x) + 1); } } if(Ni.size()!=2) { throw new IllegalArgumentException("The collection must contain observations from 2 groups."); } Object[] keys = Ni.keySet().toArray(); int n1= Ni.get(keys[0]); int n2= Ni.get(keys[1]); boolean rejectH0= checkCriticalValue((double)U, n1, n2, aLevel); return rejectH0; }  static boolean test(FlatDataCollection flatDataCollection, double aLevel);  }### Answer:
@Test public void testTest() { logger.info("test"); FlatDataCollection flatDataCollection = new FlatDataCollection(Arrays.asList(new Object[]{'Α', 'Β', 'Α', 'Β', 'Α', 'Β', 'Α', 'Β', 'Α', 'Β', 'Β', 'Α', 'Β', 'Α', 'Β', 'Α', 'Α', 'Β'})); double aLevel = 0.05; boolean expResult = true; boolean result = WaldWolfowitz.test(flatDataCollection, aLevel); assertEquals(expResult, result); }