Created
March 15, 2015 16:42
-
-
Save bcalmac/16de6b918222aa9ed5db to your computer and use it in GitHub Desktop.
Asserting file content with AssertJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import org.junit.Test; | |
import static org.assertj.core.api.Assertions.*; | |
public class FileTest { | |
@Test | |
public void file() { | |
File actualFile = new File("actual.txt"); | |
File expectedFile = new File("expected.txt"); | |
assertThat(actualFile).hasContentEqualTo(expectedFile); | |
} | |
@Test | |
public void inline() { | |
File actualFile = new File("actual.txt"); | |
assertThat(linesOf(actualFile)).containsExactly( | |
"line 1", | |
"line 2", | |
"line 3" | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment