Skip to content

Commit

Permalink
. t using approvals to print empty board
Browse files Browse the repository at this point in the history
  • Loading branch information
lexler committed Nov 10, 2023
1 parent cc1feb4 commit a8e37b8
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions src/test/java/org/samples/SampleTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,40 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class SampleTests
{
@Test
public void testNormalJunit()
{
assertEquals(5, 5);
}
@Test
public void printSimpleBoard()
{
// Approvals.verify("Hello World");
int[][] board = new int[3][3];
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
System.out.print(board[y][x]);
}
System.out.println();
public class SampleTests {

@Test
public void printSimpleBoard() {
String result = "";
int[][] board = new int[3][3];
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
result += board[y][x];
}
result += "\n";
}
Approvals.verify(result);
}

@Test
void whenLifeCellIsInTheMiddleAndItHasNoNeighborTheCellDies() {
int[][] board = new int[3][3];
board[1][1] = 1;
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
System.out.print(board[y][x]);
}
System.out.println();
}
}

}
/**
* note: this requires GSON which is currently added in the pom.xml file.
* This is only required if you want to use the VerifyAsJson.
**/
@Test
public void testJson()
{
Person hero = new Person("jayne", "cobb", true, 38);
Approvals.verifyAsJson(hero);
}
/**
* note: this requires GSON which is currently added in the pom.xml file.
* This is only required if you want to use the VerifyAsJson.
**/
@Test
public void testJson() {
Person hero = new Person("jayne", "cobb", true, 38);
Approvals.verifyAsJson(hero);
}
}

0 comments on commit a8e37b8

Please sign in to comment.