CellInfoUtil { public static List<Cell> extractCellsFromCellSpecification(String cellsSpecification) { return Arrays.stream(cellsSpecification.split(CELL_HOST_DELIM)) .filter(cellSpec -> cellSpec.contains(CELL_HOST_RULE_DELIM)) .map(cellSpec -> cellSpec.split(CELL_HOST_RULE_DELIM)) .map(parts -> new Cell(parts[0], parts[1])) .collect(Collectors.toList()); }  static List<Cell> extractCellsFromCellSpecification(String cellsSpecification); static Map<Cell, String> extractCellRoutingFromCellSpecification(List<Cell> cells, String cellRoutingSpecification);  }
@Test public void checkTwoCellSpecifications() { String cellsSpec = "cell1=hostName1:7001;cell2=hostName2:7002"; List<Cell> cells = CellInfoUtil.extractCellsFromCellSpecification(cellsSpec); assertThat(cells).isNotNull(); assertThat(cells.size()).isEqualTo(2); assertThat(cells.get(0).getAddress()).isEqualTo("hostName1:7001"); assertThat(cells.get(1).getAddress()).isEqualTo("hostName2:7002"); }
@Test public void checkSingleCellSpecifications() { String cellsSpec = "cell1=hostName1:7001"; List<Cell> cells = CellInfoUtil.extractCellsFromCellSpecification(cellsSpec); assertThat(cells).isNotNull(); assertThat(cells.size()).isEqualTo(1); assertThat(cells.get(0).getAddress()).isEqualTo("hostName1:7001"); }
@Test public void checkEmptyCellSpecifications() { String cellsSpec = ""; List<Cell> cells = CellInfoUtil.extractCellsFromCellSpecification(cellsSpec); assertThat(cells).isNotNull(); assertThat(cells.size()).isEqualTo(0); }