void (int finalCount, String... values) { int index = 0; if (myItems == null) { assertEquals(0, finalCount); return; } for (final LookupElement myItem : myItems) { for (String value : values) { if (value == null) { fail("Unacceptable value reached"); } if (value.equals(myItem.getLookupString())) { index++; break; } } } assertEquals(Arrays.toString(myItems), finalCount, index); }