CacheUtil { public static List<Detector> buildDetectors(String detectorsString) { if (detectorsString == null || "".equals(detectorsString)) { return Collections.emptyList(); } String[] detectors = detectorsString.split("\\|"); return Arrays.asList(detectors).stream() .map(detector -> new Detector(detector.split(",")[0], UUID.fromString(detector.split(",")[1]))) .collect(Collectors.toList()); }  static String getKey(Map<String, String> tags); static Map<String, String> getTags(String key); static String getDetectors(List<Detector> detectors); static List<Detector> buildDetectors(String detectorsString);  }
@Test public void buildDetectors() { initDetectors(); Assert.assertEquals(detectors, CacheUtil.buildDetectors(cacheValue)); Assert.assertEquals(Collections.EMPTY_LIST, CacheUtil.buildDetectors("")); }