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

Test cleanup #1184

Merged
merged 4 commits into from
May 30, 2024
Merged
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
3 changes: 1 addition & 2 deletions src/test/java/LiveDemoTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -20,7 +19,7 @@ class LiveDemoTest {
// what is needed to publish generated report via github.com
// http://damianszczepanik.github.io/cucumber-html-reports/overview-features.html
@Test
void generateDemoReport() throws IOException {
void generateDemoReport() {
File reportOutputDirectory = new File("target/demo");
List<String> jsonFiles = new ArrayList<>();
jsonFiles.add("src/test/resources/json/sample.json");
Expand Down
17 changes: 5 additions & 12 deletions src/test/java/net/masterthought/cucumber/ReportBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,9 @@ void copyCustomResources_OnDirAsFile_ThrowsIOException() throws Exception {
ReportBuilder builder = new ReportBuilder(Collections.<String>emptyList(), configuration);
File dir = new File("src/test/resources/js");

// then
try {
Whitebox.invokeMethod(builder, "copyCustomResources", "js", dir);
fail("Copying should fail!");
// exception depends of operating system
} catch (ValidationException e) {
// passed
}
// when & then
assertThatThrownBy(() -> Whitebox.invokeMethod(builder, "copyCustomResources", "js", dir))
.isInstanceOf(ValidationException.class);
}

@Test
Expand Down Expand Up @@ -528,15 +523,13 @@ void generateErrorPage_GeneratesErrorPage() throws Exception {
}

private File[] countHtmlFiles(Configuration configuration) {
Builder builder = WildcardFileFilter.builder().setWildcards("*.html");
FileFilter fileFilter = builder.get();
FileFilter fileFilter = WildcardFileFilter.builder().setWildcards("*.html").get();
File dir = new File(configuration.getReportDirectory(), ReportBuilder.BASE_DIRECTORY + configuration.getDirectorySuffixWithSeparator());
return dir.listFiles(fileFilter);
}

private File[] countHtmlFiles() {
Builder builder = WildcardFileFilter.builder().setWildcards("*.html");
FileFilter fileFilter = builder.get();
FileFilter fileFilter = WildcardFileFilter.builder().setWildcards("*.html").get();
File dir = new File(reportDirectory, ReportBuilder.BASE_DIRECTORY + configuration.getDirectorySuffixWithSeparator());
return dir.listFiles(fileFilter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class AllInOneReport extends ReportGenerator {

@Test
void unsupportedReportFormat() {
assertThrows(IllegalArgumentException.class, () -> {
// given
configuration.addReducingMethod(MERGE_FEATURES_WITH_RETEST);
// given
configuration.addReducingMethod(MERGE_FEATURES_WITH_RETEST);

assertThrows(IllegalArgumentException.class, () -> {
// when
// then
setUpWithJson(SAMPLE_FAILED_JSON, SAMPLE_JSON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private Element buildScenario() {
}

@Test
void updateElementsOfGivenFeature_NoCoincidencesById() throws IllegalAccessException {
void updateElementsOfGivenFeature_NoCoincidencesById() {
// given
Feature feature = new Feature();
Whitebox.setInternalState(feature, "elements", new Element[] {buildBackground(), buildScenario(), buildScenario()});
Expand All @@ -53,7 +53,7 @@ void updateElementsOfGivenFeature_NoCoincidencesById() throws IllegalAccessExcep
}

@Test
void updateElementsOfGivenFeature_WithCoincidenceById() throws IllegalAccessException {
void updateElementsOfGivenFeature_WithCoincidenceById() {
// given
Feature feature = new Feature();
Element[] elements = {buildScenario(), buildBackground(), buildScenario()};
Expand Down
Loading