Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 2 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>12</maven.compiler.source>
<maven.compiler.target>12</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
Expand Down Expand Up @@ -92,8 +92,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>12</source>
<target>12</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down
30 changes: 16 additions & 14 deletions src/test/java/com/serenitydojo/WhenWritingReadableAssertions.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.withinPercentage;

public class WhenWritingReadableAssertions {

Expand All @@ -17,7 +18,7 @@ public void whenTwoNumbersAreEqual() {
int sum = a + b + c;

// Check that the sum is 35
assertThat(true).isFalse();
assertThat(sum).isEqualTo(35);
}

@Test
Expand All @@ -28,7 +29,7 @@ public void whenANumberIsGreaterThanAnother() {
int sum = a + b + c;

// Check that the sum is greater than 30
assertThat(true).isFalse();
assertThat(sum).isGreaterThan(30);
}

@Test
Expand All @@ -38,55 +39,55 @@ public void whenANumberIsInACertainInterval() {
int sum = a + b;

// Check that the sum is between 10 and 20
assertThat(true).isFalse();
assertThat(sum).isBetween(10,20);
}

@Test
public void whenANumberIsCloseToAnotherValue() {
double roughlyOneHundred = 99;
double sum = 99;

// Check that the sum is within 10% of 100
assertThat(true).isFalse();
assertThat(sum).isCloseTo(100,withinPercentage(10));
}

@Test
public void whenAStringIsEqualToAnother() {
String color = "red";

// Check that the string has a value of 'red'
assertThat(true).isFalse();
assertThat(color).isEqualTo("red");
}

@Test
public void whenAStringIsEqualIgnoringCase() {
String color = "RED";

// Check that the string has a value of 'red' (ignoring case)
assertThat(true).isFalse();
assertThat(color).isEqualToIgnoringCase("red");
}

@Test
public void whenAStringContainsOnlyDigits() {
String licenseNumber = "12345";

// Check that the value contains only digits
assertThat(true).isFalse();
assertThat(licenseNumber).containsOnlyDigits();
}

@Test
public void whenAStringStartsWithAValue() {
String colors = "red,green,blue";

// Check that the value starts with 'red'
assertThat(true).isFalse();
assertThat(colors).startsWith("red");
}

@Test
public void whenAStringEndsWithAValue() {
String colors = "red,green,blue";

// Check that the value ends with 'blue'
assertThat(true).isFalse();
assertThat(colors).endsWith("blue");
}


Expand All @@ -95,38 +96,39 @@ public void whenAListContainsAValue() {
List<String> colors = Arrays.asList("red","green","blue");

// Check that the list contains "red"
assertThat(colors).contains("red");
}

@Test
public void whenAListContainsASetOfValues() {
List<String> colors = Arrays.asList("red","green","blue");

// Check that the list contains "red" and "blue
assertThat(true).isFalse();
assertThat(colors).contains("red","blue");
}

@Test
public void whenAListHasASpecificSize() {
List<String> colors = Arrays.asList("red","green","blue");

// Check that the list contains 3 elements
assertThat(true).isFalse();
assertThat(colors).hasSize(3);
}

@Test
public void whenAListContainsExactlyASetOfValues() {
List<String> colors = Arrays.asList("red","green","blue");

// Check that the list contains "red","green" and "blue"
assertThat(true).isFalse();
assertThat(colors).containsExactly("red","green","blue");
}

@Test
public void whenAListContainsExactlyASetOfValuesInAnyOrder() {
List<String> colors = Arrays.asList("red","green","blue");

// Check that the list contains "red","blue" and "green" in any order
assertThat(true).isFalse();
assertThat(colors).containsExactlyInAnyOrder("green","blue","red");
}


Expand Down