### Question:
DatasetUrl { @VisibleForTesting static List<String> getProtocols(String url) { List<String> allprotocols = new ArrayList<>(); StringBuilder buf = new StringBuilder(url); int slashpos = buf.indexOf("/"); if (url.startsWith("file:") && "/\\".indexOf(url.charAt(5)) < 0) { allprotocols.add("file"); } else if (slashpos >= 0) { buf.delete(slashpos + 1, buf.length()); int index = buf.indexOf(":"); while (index > 0) { if (!validateProtocol(buf, 0, index)) break; String protocol = buf.substring(0, index); allprotocols.add(protocol); buf.delete(0, index + 1); index = buf.indexOf(":"); } } return allprotocols; } private  DatasetUrl(ServiceType serviceType, String trueurl); static DatasetUrl findDatasetUrl(String orgLocation); static DatasetUrl create(@Nullable ServiceType serviceType, String trueurl); @Override boolean equals(Object o); @Override int hashCode(); ServiceType getServiceType(); String getTrueurl();  }### Answer:
@Test public void testGetProtocols() { protocheck("http: protocheck("dods: protocheck("dap4: protocheck("dap4:https: protocheck("file: protocheck("file: protocheck("file:c:/x/y/z", "file:"); protocheck("file:/blah/blah/some_file_2014-04-13_16:00:00.nc.dds", "file:"); protocheck("/blah/blah/some_file_2014-04-13_16:00:00.nc.dds", ""); protocheck("c:/x/y/z", null); protocheck("x::a/y/z", null); protocheck("x::/y/z", null); protocheck("::/y/z", ""); protocheck("dap4:&/y/z", null); protocheck("file:x/z::a", "file:"); protocheck("x/z::a", null); protocheck("thredds:http: protocheck("thredds:file:c:/dev/netcdf-java-2.2/test/data/catalog/addeStationDataset.xml#AddeSurfaceData", "thredds:file:"); protocheck("thredds:resolve:http: "thredds:resolve:http:"); protocheck("cdmremote:http: protocheck( "dap4:http: "dap4:http:"); protocheck( "dynamic:http: "dynamic:http:"); }