|
|
@ -591,24 +591,16 @@ public class PullCommandTest extends RepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
private static void writeToFile(File actFile, String string) |
|
|
|
private static void writeToFile(File actFile, String string) |
|
|
|
throws IOException { |
|
|
|
throws IOException { |
|
|
|
FileOutputStream fos = null; |
|
|
|
try (FileOutputStream fos = new FileOutputStream(actFile)) { |
|
|
|
try { |
|
|
|
|
|
|
|
fos = new FileOutputStream(actFile); |
|
|
|
|
|
|
|
fos.write(string.getBytes(UTF_8)); |
|
|
|
fos.write(string.getBytes(UTF_8)); |
|
|
|
fos.close(); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
if (fos != null) |
|
|
|
|
|
|
|
fos.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void assertFileContentsEqual(File actFile, String string) |
|
|
|
private static void assertFileContentsEqual(File actFile, String string) |
|
|
|
throws IOException { |
|
|
|
throws IOException { |
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
|
|
|
FileInputStream fis = null; |
|
|
|
|
|
|
|
byte[] buffer = new byte[100]; |
|
|
|
byte[] buffer = new byte[100]; |
|
|
|
try { |
|
|
|
try (FileInputStream fis = new FileInputStream(actFile)) { |
|
|
|
fis = new FileInputStream(actFile); |
|
|
|
|
|
|
|
int read = fis.read(buffer); |
|
|
|
int read = fis.read(buffer); |
|
|
|
while (read > 0) { |
|
|
|
while (read > 0) { |
|
|
|
bos.write(buffer, 0, read); |
|
|
|
bos.write(buffer, 0, read); |
|
|
@ -616,9 +608,6 @@ public class PullCommandTest extends RepositoryTestCase { |
|
|
|
} |
|
|
|
} |
|
|
|
String content = new String(bos.toByteArray(), "UTF-8"); |
|
|
|
String content = new String(bos.toByteArray(), "UTF-8"); |
|
|
|
assertEquals(string, content); |
|
|
|
assertEquals(string, content); |
|
|
|
} finally { |
|
|
|
|
|
|
|
if (fis != null) |
|
|
|
|
|
|
|
fis.close(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|