Skip to content

Commit

Permalink
Merge pull request openmrs#2650 from PKatGITHUB/TRUNK-5065
Browse files Browse the repository at this point in the history
TRUNK-5065: Add tests to AdministrationServiceImpl
  • Loading branch information
teleivo authored Apr 12, 2018
2 parents 1475c8a + e8b441d commit 4b7461d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion api/src/test/java/org/openmrs/api/AdministrationServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
*/
package org.openmrs.api;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -449,6 +449,18 @@ public void saveGlobalProperty_shouldFailIfGivenAllowedLocaleListDoesNotContainD
adminService.saveGlobalProperty(
new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST, localeList));
}

@Test
public void saveGlobalProperty_shouldFailIfDefaultLocaleNotInAllowedLocaleList() {

Locale defaultLocale = new Locale("fr");

expectedException.expect(APIException.class);
expectedException.expectMessage("is not in allowed locales list");

adminService.saveGlobalProperty(
new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE, defaultLocale.toString()));
}

@Test
public void getAllowedLocales_shouldNotReturnDuplicatesEvenIfTheGlobalPropertyHasThem() {
Expand Down

0 comments on commit 4b7461d

Please sign in to comment.