diff --git a/src/test/java/LiveDemoTest.java b/src/test/java/LiveDemoTest.java index 89142b8ba..d928efe94 100644 --- a/src/test/java/LiveDemoTest.java +++ b/src/test/java/LiveDemoTest.java @@ -1,5 +1,4 @@ import java.io.File; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -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 jsonFiles = new ArrayList<>(); jsonFiles.add("src/test/resources/json/sample.json"); diff --git a/src/test/java/net/masterthought/cucumber/ReportBuilderTest.java b/src/test/java/net/masterthought/cucumber/ReportBuilderTest.java index ad5869587..5f20d160d 100644 --- a/src/test/java/net/masterthought/cucumber/ReportBuilderTest.java +++ b/src/test/java/net/masterthought/cucumber/ReportBuilderTest.java @@ -221,14 +221,9 @@ void copyCustomResources_OnDirAsFile_ThrowsIOException() throws Exception { ReportBuilder builder = new ReportBuilder(Collections.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 @@ -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); } diff --git a/src/test/java/net/masterthought/cucumber/ReportResultMergeTest.java b/src/test/java/net/masterthought/cucumber/ReportResultMergeTest.java index 3fbd6f0e1..53b031d97 100644 --- a/src/test/java/net/masterthought/cucumber/ReportResultMergeTest.java +++ b/src/test/java/net/masterthought/cucumber/ReportResultMergeTest.java @@ -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); diff --git a/src/test/java/net/masterthought/cucumber/reducers/ReportFeatureWithRetestMergerTest.java b/src/test/java/net/masterthought/cucumber/reducers/ReportFeatureWithRetestMergerTest.java index 05050ed23..814ccfd75 100644 --- a/src/test/java/net/masterthought/cucumber/reducers/ReportFeatureWithRetestMergerTest.java +++ b/src/test/java/net/masterthought/cucumber/reducers/ReportFeatureWithRetestMergerTest.java @@ -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()}); @@ -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()};