public static Set<String> assertValidProtocols(Set<String> expected,String[] protocols){
  assertNotNull(protocols);
  assertTrue(protocols.length != 0);
  Set remainingProtocols=new HashSet<String>(expected);
  Set unknownProtocols=new HashSet<String>();
  for (  String protocol : protocols) {
    if (!remainingProtocols.remove(protocol)) {
      unknownProtocols.add(protocol);
    }
  }
  assertEquals("Unknown protocols",Collections.EMPTY_SET,unknownProtocols);
  return remainingProtocols;
}

public static Set < String > assertValidProtocols ( Set < String > expected , String [ ] protocols ) { assertNotNull ( protocols ) ; assertTrue ( protocols . length != 0 ) ; Set remainingProtocols = new HashSet < String > ( expected ) ; Set unknownProtocols = new HashSet < String > ( ) ; for ( String protocol : protocols ) { if ( ! remainingProtocols . remove ( protocol ) ) { unknownProtocols . add ( protocol ) ; } } assertEquals ( "Unknown protocols" , Collections . EMPTY_SET , unknownProtocols ) ; return remainingProtocols ; }
asserts that the protocols array is non - null and that it all of its contents are protocols known to this implementation . as a convenience , returns any unenabled protocols in a test for those that want to verify separately that all protocols were included .
