@@ -0,0 +1,3068 @@
+package com.microsoft.alm.plugin.idea.tfvc.core.tfs;%0A%0Aimport com.google.common.base.Function;%0Aimport com.google.common.collect.Iterables;%0Aimport com.google.common.collect.Lists;%0Aimport com.intellij.openapi.project.Project;%0Aimport com.intellij.openapi.vcs.FilePath;%0Aimport com.intellij.openapi.vcs.LocalFilePath;%0Aimport com.microsoft.alm.plugin.external.models.Workspace;%0Aimport com.microsoft.alm.plugin.external.utils.CommandUtils;%0Aimport org.checkerframework.checker.nullness.qual.Nullable;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.powermock.api.mockito.PowerMockito;%0Aimport org.powermock.core.classloader.annotations.PrepareForTest;%0Aimport org.powermock.modules.junit4.PowerMockRunner;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.mockito.Mockito.when;%0A%0A@RunWith(PowerMockRunner.class)%0A@PrepareForTest(%7BCommandUtils.class%7D)%0Apublic class TFVCUtilTest %7B%0A%0A    private final Workspace workspace = new Workspace(%0A            %22server%22,%0A            %22name%22,%0A            %22computer%22,%0A            %22owner%22,%0A            %22comment%22,%0A            Arrays.asList(new Workspace.Mapping(%22serverPath%22, %22/tmp/localPath%22, false)));%0A%0A    @Mock%0A    private Project mockProject;%0A%0A    @Before%0A    public void setUp() %7B%0A        MockitoAnnotations.initMocks(this);%0A%0A        PowerMockito.mockStatic(CommandUtils.class);%0A        when(CommandUtils.getPartialWorkspace(mockProject)).thenReturn(workspace);%0A    %7D%0A%0A    @Test%0A    public void isFileUnderTFVCMappingShouldTests() %7B%0A        Assert.assertTrue(TFVCUtil.isFileUnderTFVCMapping(mockProject, new LocalFilePath(%22/tmp/localPath/1.txt%22, false)));%0A        Assert.assertTrue(TFVCUtil.isFileUnderTFVCMapping(mockProject, new LocalFilePath(%22/tmp/localPath%22, true)));%0A        Assert.assertFalse(TFVCUtil.isFileUnderTFVCMapping(mockProject, new LocalFilePath(%22/tmp/localPath1%22, true)));%0A        Assert.assertFalse(TFVCUtil.isFileUnderTFVCMapping(mockProject, new LocalFilePath(%22/tmp/localPath1/1.txt%22, false)));%0A    %7D%0A%0A    @Test%0A    public void filterValidTFVCPathsTest() %7B%0A        List%3CFilePath%3E localFiles = Arrays.%3CFilePath%3EasList(%0A                new LocalFilePath(%22/tmp/localPath%22, true),%0A                new LocalFilePath(%22/tmp/localPath/1.txt%22, false));%0A        List%3CFilePath%3E nonLocalFiles = Arrays.%3CFilePath%3EasList(%0A                new LocalFilePath(%22/tmp/localPath1%22, true),%0A                new LocalFilePath(%22/tmp/localPath1/1.txt%22, false));%0A        List%3CFilePath%3E allPaths = Lists.newArrayList(Iterables.concat(localFiles, nonLocalFiles));%0A        List%3CString%3E localFilePaths = Lists.transform(localFiles, new Function%3CFilePath, String%3E() %7B%0A            @Override%0A            public String apply(@Nullable FilePath input) %7B%0A                return input.getPath();%0A            %7D%0A        %7D);%0A        assertThat(TFVCUtil.filterValidTFVCPaths(mockProject, allPaths), is(localFilePaths));%0A    %7D%0A%7D%0A

Add tests for TFVCUtil (#173)