### Question:
JavaConfig { List<String> getDebugOptions() { List<String> empty = Collections.emptyList(); String debugOptions = map.get("debug-options"); if(!GFLauncherUtils.ok(debugOptions)) { return empty; } if (JDK.getMajor() >= 9) { boolean serverMode = false; String address = null; for (String debugOption : debugOptions.split(",")) { if (debugOption.startsWith("server")) { String[] serverAttr = debugOption.split("="); serverMode = serverAttr.length > 1 && serverAttr[1].equals("y"); } if (debugOption.startsWith("address")) { String[] addressAttr = debugOption.split("="); if (addressAttr.length > 1) { address = addressAttr[1]; } } } if (serverMode && address != null) { if (address.split(":").length < 2) { debugOptions = debugOptions.replace("address=", "address=*:"); } } } String[] debugOptionArray = debugOptions.split(" "); if(debugOptionArray.length <= 0) { return empty; } return Arrays.asList(debugOptionArray); } JavaConfig(Map<String, String> map);   }### Answer:
@Test public void debugInClientMode() { String DEBUG_CONFIG = "-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y"; Map<String, String> config = new HashMap<>(); config.put("debug-options", DEBUG_CONFIG); JavaConfig javaConfig = new JavaConfig(config); List<String> debugOptions = javaConfig.getDebugOptions(); Assert.assertEquals(DEBUG_CONFIG, debugOptions.get(0)); }
@Test public void debugInServerMode() { String DEBUG_CONFIG = "-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n"; Map<String, String> config = new HashMap<>(); config.put("debug-options", DEBUG_CONFIG); JavaConfig javaConfig = new JavaConfig(config); List<String> debugOptions = javaConfig.getDebugOptions(); if (JDK.getMajor() >= 9) { Assert.assertEquals("-agentlib:jdwp=transport=dt_socket,address=*:9009,server=y,suspend=n", debugOptions.get(0)); } else { Assert.assertEquals(DEBUG_CONFIG, debugOptions.get(0)); } }