Skip to content

Commit 13dcb43

Browse files
committed
fixed errors
1 parent 5745ced commit 13dcb43

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

java/com/spun/util/SystemUtils.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,23 @@ public static boolean isWindowsEnviroment()
88
{
99
return "\\".equals(File.separator);
1010
}
11+
public static String convertFileForCommandLine(String fileName)
12+
{
13+
return convertFileForCommandLine(fileName, SystemUtils.isWindowsEnviroment());
14+
}
15+
public static String convertFileForCommandLine(String fileName, boolean windowsOs)
16+
{
17+
if (!fileName.contains(" "))
18+
{
19+
return fileName;
20+
}
21+
else if (windowsOs)
22+
{
23+
return String.format("\"%s\"", fileName);
24+
}
25+
else
26+
{
27+
return fileName.replace(" ", "\\ ");
28+
}
29+
}
1130
}

java/org/approvaltests/reporters/GenericDiffReporter.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.util.Arrays;
66
import java.util.List;
77

8-
import com.spun.util.SystemUtils;
98
import com.spun.util.ThreadUtils;
109
import com.spun.util.io.FileUtils;
1110

@@ -59,25 +58,6 @@ public String[] getCommandLine(String received, String approved)
5958
System.out.println(Arrays.toString(commands));
6059
return commands;
6160
}
62-
public static String convertFileForCommandLine(String fileName)
63-
{
64-
return convertFileForCommandLine(fileName, SystemUtils.isWindowsEnviroment());
65-
}
66-
public static String convertFileForCommandLine(String fileName, boolean windowsOs)
67-
{
68-
if (!fileName.contains(" "))
69-
{
70-
return fileName;
71-
}
72-
else if (windowsOs)
73-
{
74-
return String.format("\"%s\"", fileName);
75-
}
76-
else
77-
{
78-
return fileName.replace(" ", "\\ ");
79-
}
80-
}
8161
@Override
8262
public boolean isWorkingInThisEnvironment(String forFile)
8363
{

java/org/approvaltests/reporters/tests/GenericDiffReporterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.approvaltests.strings.Printer;
1515

1616
import com.spun.util.ClassUtils;
17+
import com.spun.util.SystemUtils;
1718

1819
public class GenericDiffReporterTest extends TestCase
1920
{
@@ -49,7 +50,7 @@ public void testCommandLineFileNames() throws Exception
4950
}
5051
public String getFileName(String name, Boolean osType)
5152
{
52-
return GenericDiffReporter.convertFileForCommandLine(name, osType);
53+
return SystemUtils.convertFileForCommandLine(name, osType);
5354
}
5455
private void approveGenericReporter(String a, String b, GenericDiffReporter reporter) throws Exception
5556
{

java/org/approvaltests/reporters/tests/QueryableDiffReporterHarness.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.approvaltests.reporters.tests;
22

3+
import org.apache.hadoop.util.StringUtils;
34
import org.approvaltests.reporters.GenericDiffReporter;
45

56
import com.spun.util.persistence.ExecutableQuery;
@@ -18,7 +19,8 @@ public QueryableDiffReporterHarness(GenericDiffReporter reporter, String file1,
1819
@Override
1920
public String getQuery() throws Exception
2021
{
21-
return reporter.getCommandLine("%s", "%s");
22+
String[] commandLine = reporter.getCommandLine("%s", "%s");
23+
return StringUtils.join(" ", commandLine);
2224
}
2325
@Override
2426
public String executeQuery(String query) throws Exception

0 commit comments

Comments
 (0)