diff --git a/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/advice/BahmniEncounterTransactionUpdateAdviceTest.java b/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/advice/BahmniEncounterTransactionUpdateAdviceTest.java index 237e69b3da..c94c104603 100644 --- a/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/advice/BahmniEncounterTransactionUpdateAdviceTest.java +++ b/bahmni-emr-api/src/test/java/org/openmrs/module/bahmniemrapi/encountertransaction/advice/BahmniEncounterTransactionUpdateAdviceTest.java @@ -1,8 +1,10 @@ package org.openmrs.module.bahmniemrapi.encountertransaction.advice; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.openmrs.module.bahmniemrapi.encountertransaction.contract.BahmniEncounterTransaction; +import org.openmrs.util.LocaleUtility; import org.openmrs.util.OpenmrsUtil; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -12,15 +14,23 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; +import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.powermock.api.mockito.PowerMockito.when; import org.apache.commons.lang.StringUtils; +import java.util.Locale; + @RunWith(PowerMockRunner.class) @PrepareForTest(OpenmrsUtil.class) public class BahmniEncounterTransactionUpdateAdviceTest { private static String DEFAULT_ENCOUNTER_UUID = "defaultEncounterUuid"; + @Before + public void setUp() throws Exception { + mockStatic(OpenmrsUtil.class); + } + @Test public void shouldExecuteObsValueCalculatorFromApplicationDataDirectory() throws Throwable { PowerMockito.mockStatic(OpenmrsUtil.class); @@ -40,13 +50,13 @@ public void shouldLoadpplicationDataDirectoryPath() throws Throwable { path = StringUtils.chop(path); System.out.println(path); when(OpenmrsUtil.getApplicationDataDirectory()).thenReturn(path); - + BahmniEncounterTransaction bahmniEncounterTransaction = new BahmniEncounterTransaction(); new BahmniEncounterTransactionUpdateAdvice().before(null, new BahmniEncounterTransaction[]{bahmniEncounterTransaction}, null); assertThat(bahmniEncounterTransaction.getEncounterUuid(), is(equalTo(DEFAULT_ENCOUNTER_UUID))); } - + @Test public void shouldNotFailIfobscalculatorDirectoryDoesNotExist() throws Throwable { PowerMockito.mockStatic(OpenmrsUtil.class); @@ -57,4 +67,4 @@ public void shouldNotFailIfobscalculatorDirectoryDoesNotExist() throws Throwable assertThat(bahmniEncounterTransaction.getEncounterUuid(), is(not(equalTo(DEFAULT_ENCOUNTER_UUID)))); } -} \ No newline at end of file +}