### Question:
DataGatheringParams { public static List<String> getContextRegisterList(String contextRegsCSV) { List<String> contextRegisters = new ArrayList<>(); if (contextRegsCSV == null) { return contextRegisters; } contextRegsCSV = contextRegsCSV.trim(); if ((contextRegsCSV.equals("")) || contextRegsCSV.equals("null")) { return contextRegisters; } String[] components = contextRegsCSV.split(","); for (String component : components) { if (!StringUtils.isEmpty(component.trim())) { contextRegisters.add(component.trim()); } } return contextRegisters; } DataGatheringParams(); int getNumPreBytes(); void setNumPreBytes(int preBytes); int getNumFirstBytes(); void setNumFirstBytes(int firstBytes); int getNumReturnBytes(); void setNumReturnBytes(int returnBytes); int getNumPreInstructions(); void setNumPreInstructions(int preInstructions); int getNumFirstInstructions(); void setNumFirstInstructions(int firstInstructions); int getNumReturnInstructions(); void setNumReturnInstructions(int returnInstructions); List<String> getContextRegisters(); void setContextRegisters(List<String> cRegs); static List<String> getContextRegisterList(String contextRegsCSV);  }### Answer:
@Test public void testNullString() { List<String> contextRegs = DataGatheringParams.getContextRegisterList(null); assertTrue(contextRegs.isEmpty()); }
@Test public void testEmptyString() { List<String> contextRegs = DataGatheringParams.getContextRegisterList(""); assertTrue(contextRegs.isEmpty()); }
@Test public void testLiteralNull() { List<String> contextRegs = DataGatheringParams.getContextRegisterList("null"); assertTrue(contextRegs.isEmpty()); }
@Test public void testEmptyRegName() { List<String> contextRegs = DataGatheringParams.getContextRegisterList("reg1, ,reg2"); Set<String> regSet = new HashSet<String>(contextRegs); assertEquals(regSet.size(), 2); assertTrue(regSet.contains("reg1")); assertTrue(regSet.contains("reg2")); }
@Test public void testNameTrimming() { List<String> contextRegs = DataGatheringParams.getContextRegisterList(" reg1, reg2 ,reg3 "); Set<String> regSet = new HashSet<String>(contextRegs); assertEquals(regSet.size(), 3); assertTrue(regSet.contains("reg1")); assertTrue(regSet.contains("reg2")); assertTrue(regSet.contains("reg3")); }