Skip to content

Commit

Permalink
BS-258 | Vijay, Siva | Fixing failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayanandtwks committed Sep 21, 2023
1 parent e367e6a commit b0d6119
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.bahmni.reports.extensions.sample;

import net.sf.dynamicreports.jasper.builder.JasperReportBuilder;
import net.sf.dynamicreports.report.constant.HorizontalAlignment;
import org.bahmni.reports.extensions.ResultSetExtension;

import java.sql.SQLException;
import java.util.Collection;
import java.util.Map;
import java.util.Random;

import static net.sf.dynamicreports.report.builder.DynamicReports.col;
import static net.sf.dynamicreports.report.builder.DynamicReports.type;
import static org.bahmni.reports.template.Templates.columnStyle;

public class SampleResultSetExtension implements ResultSetExtension {
public static final String SAMPLE_COLUMN_NAME = "Sample Column";

public void enrich(Collection<Map<String, ?>> collection, JasperReportBuilder jasperReport) throws SQLException {
for (Map<String, ?> rowMap : collection) {
enrichRow(rowMap, SAMPLE_COLUMN_NAME, String.valueOf(new Random().nextInt()));
}
jasperReport.addColumn(col.column(SAMPLE_COLUMN_NAME, SAMPLE_COLUMN_NAME, type.stringType()).setStyle(columnStyle).setHorizontalAlignment(HorizontalAlignment.CENTER));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void shouldIncludeIcd10TerminologyCodeColumnInJasperReport() throws Excep

tsIntegrationDiagnosisLineReportTemplate.build(mockConnection, mockJasperReport, mockReport, "dummyStartDate", "dummyEndDate", null, PageType.A4);

verify(mockJasperReport, times(9)).addColumn(any());
verify(mockJasperReport, times(8)).addColumn(any());
}

private TSIntegrationDiagnosisLineReportConfig getMockTerminologyDiagnosisLineReportConfig(boolean displayTerminologyCodeFlag, boolean shortNamePreferredFlag, boolean icd10ExtensionFlag) {
Expand All @@ -272,7 +272,7 @@ private TSIntegrationDiagnosisLineReportConfig getMockTerminologyDiagnosisLineRe
if (shortNamePreferredFlag)
tsIntegrationDiagnosisLineReportConfig.setConceptNameDisplayFormat("shortNamePreferred");
if (icd10ExtensionFlag)
tsIntegrationDiagnosisLineReportConfig.setExtensions(Arrays.asList("org.bahmni.reports.extensions.icd10.Icd10ResultSetExtension", "org.bahmni.reports.extensions.sample.SampleResultSetExtension"));
tsIntegrationDiagnosisLineReportConfig.setExtensions(Arrays.asList("org.bahmni.reports.extensions.sample.SampleResultSetExtension"));
return tsIntegrationDiagnosisLineReportConfig;
}

Expand Down

0 comments on commit b0d6119

Please sign in to comment.