Skip to content

Commit

Permalink
BAH-2916 | Fix. Lab Result Value Sync Issue in Clinical Dashboard (#76)
Browse files Browse the repository at this point in the history
* Parvathy | BAH-2916 | Fix. Date Format of Accession Note

* Parvathy | BAH-2916 | Add. Unit test for ISODateFormat
  • Loading branch information
parvathy00 authored Jan 25, 2024
1 parent e4f9213 commit 970b3ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ private List<AccessionNote> mapToAccessionNotes(List<Note> accessionNotes) {
return accessionNotesToPublish;
}

private String toISODateFormat(Timestamp timestamp){
return DateFormatUtils.format(timestamp.getTime(),DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());
String toISODateFormat(Timestamp timestamp){
return DateFormatUtils.format(timestamp.getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern());
}

private void mapSampleItem(List<TestDetail> testDetails, SampleItem sampleItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@
import us.mn.state.health.lims.systemuser.dao.SystemUserDAO;
import us.mn.state.health.lims.testresult.valueholder.TestResult;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -226,6 +230,19 @@ public void shouldSetResultValueForNumeric() {
assertEquals("10", testDetail.getResult());
}

@Test
public void shouldReturnISODateFormat() throws ParseException {
AccessionService accessionService = new TestableAccessionService(sampleDao, sampleHumanDAO, externalReferenceDao, noteDao, dictionaryDao, patientIdentityDAO, patientIdentityTypeDAO, siteInformationDAO);
String dateString = "2024-01-22T12:34:56";
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date = dateFormat.parse(dateString);
Timestamp timestamp = new Timestamp(date.getTime());

String result = accessionService.toISODateFormat(timestamp);

assertEquals(dateString, result);
}

private class TestableAccessionService extends AccessionService {

public TestableAccessionService(SampleDAO sampleDao, SampleHumanDAO sampleHumanDAO,
Expand Down

0 comments on commit 970b3ec

Please sign in to comment.