ClusterList { public List<String> get() { return Lists.newArrayList(this.config.clusters().trim().split(",")) .stream() .filter(cluster -> !cluster.isEmpty()) .collect(Collectors.toList()); } ClusterList(Config config); List<String> get();  }
@Test public void emptyClustersReturnEmptyList() { final List<String> clusters = new ClusterList( new ClusterListTest.FakeConfig("") ).get(); Assertions.assertThat(clusters) .isEmpty(); }
@Test public void validClustersReturnItsValues() { final List<String> clusters = new ClusterList( new ClusterListTest.FakeConfig("cluster1,cluster2,cluster3") ).get(); Assertions.assertThat(clusters) .hasSize(3) .contains("cluster1", "cluster2", "cluster3"); }