Skip to content

Commit

Permalink
Debug: temporarily print out contents when snapshot files differ
Browse files Browse the repository at this point in the history
  • Loading branch information
wadimw committed Oct 2, 2023
1 parent 7eb1ec2 commit 5bb3f0c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test-common/src/main/java/com/box/l10n/mojito/test/IOTestBase.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package com.box.l10n.mojito.test;

import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

import com.google.common.base.Function;
import com.google.common.io.Files;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Collection;
import java.util.List;

import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class IOTestBase {

Expand Down Expand Up @@ -248,6 +248,10 @@ protected void checkDirectoriesContainSameContent(File dir1, File dir2) throws D

// If that's a file, check that the both files have the same content
if (file2.isFile() && !Files.equal(file1, file2)) {
logger.info("File: " + file1.toString());
logger.info(Files.readLines(file1,StandardCharsets.UTF_8).stream().collect(Collectors.joining("\n")));
logger.info("File: " + file2.toString());
logger.info(Files.readLines(file2,StandardCharsets.UTF_8).stream().collect(Collectors.joining("\n")));
throw new DifferentDirectoryContentException("File: " + file1.toString() +
" and file: " + file2.toString() + " have different content");
}
Expand Down

0 comments on commit 5bb3f0c

Please sign in to comment.