Skip to content

Commit

Permalink
Change the visibility of the reportParser field (#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
jit3pam authored Nov 16, 2024
1 parent 5e084d9 commit 24505dd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/net/masterthought/cucumber/ReportBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public class ReportBuilder {
private static final ObjectMapper mapper = new ObjectMapper();

private ReportResult reportResult;
private final ReportParser reportParser;

private ReportParser reportParser;
private Configuration configuration;
private List<String> jsonFiles;

Expand All @@ -71,6 +70,14 @@ public ReportBuilder(List<String> jsonFiles, Configuration configuration) {
reportParser = new ReportParser(configuration);
}

public ReportParser getReportParser() {
return reportParser;
}

public void setReportParser(ReportParser reportParser) {
this.reportParser = reportParser;
}

/**
* Parses provided files and generates the report. When generating process fails
* report with information about error is provided.
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/net/masterthought/cucumber/ReportBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ void ReportBuilder_storesFilesAndConfiguration() {
assertThat(assignedConfiguration).isSameAs(configuration);
}

@Test
void ReportBuilder_setsAndGetsCustomReportParser(){
// given
final List<String> jsonFiles = new ArrayList<>();
final Configuration configuration = new Configuration(null, null);
final ReportParser reportParser = new ReportParser(configuration);

// when
ReportBuilder builder = new ReportBuilder(jsonFiles, configuration);
builder.setReportParser(reportParser);

// then
ReportParser assignedReportParser = Whitebox.getInternalState(builder, "reportParser");

assertThat(assignedReportParser).isSameAs(builder.getReportParser());
}

@Test
void generateReports_GeneratesPages() {

Expand Down

0 comments on commit 24505dd

Please sign in to comment.