Skip to content

Commit

Permalink
[tests] Combine assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
hazendaz committed Mar 4, 2024
1 parent cc74cb3 commit 38f697f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ void addClassificationFiles_addsPropertyFiles() {

// then
List<String> returnedPropertiesFiles = configuration.getClassificationFiles();
assertThat(returnedPropertiesFiles).hasSize(2);
assertThat(returnedPropertiesFiles).containsExactly(
assertThat(returnedPropertiesFiles).hasSize(2).containsExactly(
("properties-1.properties"),
("properties-2.properties")
);
Expand Down
15 changes: 5 additions & 10 deletions src/test/java/net/masterthought/cucumber/ReportParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ void parseClassificationsFiles_Populates_Two_Files() {

// then
List<Map.Entry<String, String>> returnedClassifications = configuration.getClassifications();
assertThat(returnedClassifications).hasSize(8);
assertThat(returnedClassifications)
assertThat(returnedClassifications).hasSize(8)
.contains(new AbstractMap.SimpleEntry<>("AutUiVersion", "1.25.3"), Index.atIndex(1))
.contains(new AbstractMap.SimpleEntry<>("firefoxVersion", "56.0"), Index.atIndex(4))
.contains(new AbstractMap.SimpleEntry<>("Proxy", "http=//172.22.240.68:18717"), Index.atIndex(6))
Expand All @@ -219,8 +218,7 @@ void parseClassificationsFiles_Populates_Two_Files_One_Empty() {

// then
List<Map.Entry<String, String>> returnedClassifications = configuration.getClassifications();
assertThat(returnedClassifications).hasSize(5);
assertThat(returnedClassifications)
assertThat(returnedClassifications).hasSize(5)
.contains(new AbstractMap.SimpleEntry<>("AutUiVersion", "1.25.3"), Index.atIndex(1))
.contains(new AbstractMap.SimpleEntry<>("firefoxVersion", "56.0"), Index.atIndex(4));
}
Expand All @@ -237,8 +235,7 @@ void parseClassificationsFiles_Populates_Check_Content_Integrity_And_Order() {

// then
List<Map.Entry<String, String>> classifications = configuration.getClassifications();
assertThat(classifications).hasSize(3);
assertThat(classifications).containsExactly(
assertThat(classifications).hasSize(3).containsExactly(
entry("NodeJsVersion", "8.5.0"),
entry("Proxy", "http=//172.22.240.68:18717"),
entry("NpmVersion", "5.3.0")
Expand All @@ -257,8 +254,7 @@ void parseClassificationsFiles_Populates_Check_Duplicates() {

// then
List<Map.Entry<String, String>> classifications = configuration.getClassifications();
assertThat(classifications).hasSize(1);
assertThat(classifications).containsExactly(
assertThat(classifications).hasSize(1).containsExactly(
entry("BaseUrl_QA", "[Internal=https://internal.test.com, External=https://external.test.com]")
);
}
Expand All @@ -275,8 +271,7 @@ void parseClassificationsFiles_Populates_Check_Special_Characters() {

// then
List<Map.Entry<String, String>> classifications = configuration.getClassifications();
assertThat(classifications).hasSize(6);
assertThat(classifications).containsExactly(
assertThat(classifications).hasSize(6).containsExactly(
entry("website", "https://en.wikipedia.org/"),
entry("language", "English"),
entry("message", "Welcome to Wikipedia!"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ void sortSteps_OnNATURAL_ReturnsSameList() {
List<StepObject> stepObjects = sortingFactory.sortSteps(steps);

// then
assertThat(stepObjects).hasSize(16);
assertThat(stepObjects).first().isEqualTo(steps.get(0));
assertThat(stepObjects).hasSize(16).first().isEqualTo(steps.get(0));
assertThat(stepObjects).last().isEqualTo(steps.get(15));
}

Expand All @@ -101,8 +100,7 @@ void sortSteps_OnALPHABETICAL_ReturnsSameList() {

// then
// TODO: as the tags are stored in TreeMap, this returns already sorted elements
assertThat(stepObjects).hasSize(16);
assertThat(stepObjects).first().isEqualTo(steps.get(0));
assertThat(stepObjects).hasSize(16).first().isEqualTo(steps.get(0));
assertThat(stepObjects).last().isEqualTo(steps.get(15));
}

Expand Down

0 comments on commit 38f697f

Please sign in to comment.