### Question:
YarnVolumeConfigProvider implements CmHostGroupRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source) { switch (roleType) { case YarnRoles.NODEMANAGER: Integer volumeCount = Objects.nonNull(hostGroupView) ? hostGroupView.getVolumeCount() : 0; return List.of( config(NODE_LOCAL_DIRS, buildVolumePathStringZeroVolumeHandled(volumeCount, "nodemanager")), config(NODE_LOG_DIRS, buildVolumePathStringZeroVolumeHandled(volumeCount, "nodemanager/log")) ); default: return List.of(); } }  @Override List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, HostgroupView hostGroupView, TemplatePreparationObject source); @Override String getServiceType(); @Override Set<String> getRoleTypes(); @Override boolean sharedRoleType(String roleType);  }### Answer:
@Test void getRoleConfigsWithMultipleVolumes() { HostgroupView worker = hostGroupWithVolumeCount(2); List<ApiClusterTemplateConfig> roleConfigs = subject.getRoleConfigs(YarnRoles.NODEMANAGER, worker, preparatorWithHostGroups(worker)); assertEquals( List.of( config("yarn_nodemanager_local_dirs", "/hadoopfs/fs1/nodemanager,/hadoopfs/fs2/nodemanager"), config("yarn_nodemanager_log_dirs", "/hadoopfs/fs1/nodemanager/log,/hadoopfs/fs2/nodemanager/log") ), roleConfigs ); }
@Test void getRoleConfigsWithoutVolumes() { HostgroupView worker = hostGroupWithVolumeCount(0); List<ApiClusterTemplateConfig> roleConfigs = subject.getRoleConfigs(YarnRoles.NODEMANAGER, worker, preparatorWithHostGroups(worker)); assertEquals( List.of( config("yarn_nodemanager_local_dirs", "/hadoopfs/root1/nodemanager"), config("yarn_nodemanager_log_dirs", "/hadoopfs/root1/nodemanager/log") ), roleConfigs ); }