PVCSubPathHelper { @VisibleForTesting String[] buildCommand(String[] base, String... dirs) { return Stream.concat( Arrays.stream(base), Arrays.stream(dirs) .map(dir -> JOB_MOUNT_PATH + (dir.startsWith("/") ? dir : '/' + dir))) .toArray(String[]::new); } @Inject  PVCSubPathHelper(
      @Named("che.infra.kubernetes.pvc.jobs.memorylimit") String jobMemoryLimit,
      @Named("che.infra.kubernetes.pvc.jobs.image") String jobImage,
      @Named("che.infra.kubernetes.pvc.jobs.image.pull_policy") String imagePullPolicy,
      KubernetesNamespaceFactory factory,
      SecurityContextProvisioner securityContextProvisioner,
      ExecutorServiceWrapper executorServiceWrapper,
      RuntimeEventsPublisher eventPublisher);   }
@Test public void testBuildsCommandByGivenBaseAndPaths() throws Exception { final String[] paths = {WORKSPACE_ID + PROJECTS_PATH, WORKSPACE_ID + M2_PATH}; final String[] actual = pvcSubPathHelper.buildCommand(MKDIR_COMMAND_BASE, paths); final String[] expected = new String[MKDIR_COMMAND_BASE.length + 2]; System.arraycopy(MKDIR_COMMAND_BASE, 0, expected, 0, MKDIR_COMMAND_BASE.length); expected[expected.length - 1] = JOB_MOUNT_PATH + '/' + WORKSPACE_ID + M2_PATH; expected[expected.length - 2] = JOB_MOUNT_PATH + '/' + WORKSPACE_ID + PROJECTS_PATH; assertEquals(actual, expected); }