### Question:
VolumeConfigProvider { public String getValue(boolean global, Integer volumeCount, ConfigProperty property, String serviceName) { String directory = serviceName.toLowerCase() + (property.getDirectory().isEmpty() ? "" : '/' + property.getDirectory()); String value = null; if (volumeCount == null && global) { value = property.getPrefix() + VolumeUtils.getLogVolume(directory); } else if (volumeCount != null && volumeCount > 0) { value = global ? property.getPrefix() + VolumeUtils.getLogVolume(directory) : VolumeUtils.buildVolumePathString(volumeCount, directory); } return value; }  String getValue(boolean global, Integer volumeCount, ConfigProperty property, String serviceName);  }### Answer:
@Test public void testGetValueWhenVolumeParameterPresentedAndGlobalThenShouldReturnTwoSegment() { ConfigProperty configProperty = new ConfigProperty("namenode", "testDirectory", "testPrefix"); String actual = underTest.getValue(false, 2, configProperty, "namenode"); Assert.assertEquals("/hadoopfs/fs1/namenode/testDirectory,/hadoopfs/fs2/namenode/testDirectory", actual); }
@Test public void testGetValueWhenVolumeParameterIsNullAndNotGlobalThenShouldReturnOneSegment() { ConfigProperty configProperty = new ConfigProperty("namenode", "testDirectory", "testPrefix"); String actual = underTest.getValue(true, null, configProperty, "namenode"); Assert.assertEquals("testPrefix/hadoopfs/fs1/namenode/testDirectory", actual); }