Skip to content

Commit

Permalink
RESTWS-739:Reposting metadata should not persist changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcliff committed Nov 26, 2019
1 parent 97549ed commit 50efd1a
Show file tree
Hide file tree
Showing 22 changed files with 134 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void shouldCreateANewOrderType() throws Exception {
assertEquals(orderType.get("description"), Util.getByPath(newOrder, "description"));
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditAnOrderType() throws Exception {
final String newName = "Updated name";
SimpleObject conceptMapTypeType = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_12;

import static org.junit.Assert.assertEquals;

import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
Expand All @@ -23,7 +25,6 @@
import org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;
import static org.junit.Assert.assertEquals;

/**
* Tests functionality of OrderSet CRUD by MainResourceController
Expand Down Expand Up @@ -127,7 +128,7 @@ public void shouldCreateAnOrderSetWithSomeOrderSetMembers() throws Exception {
Assert.assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditAnOrderSet() throws Exception {

final String editedName = "OrderSet Edited";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;

import java.util.Date;
import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
Expand Down Expand Up @@ -114,7 +113,7 @@ public void shouldCreateAConceptSource() throws Exception {
Assert.assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditAConceptSource() throws Exception {
final String newName = "updated name";
SimpleObject conceptSource = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

import java.util.Date;
import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Before;
Expand Down Expand Up @@ -109,7 +107,7 @@ public void shouldCreateAEncounterType() throws Exception {
assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditingAnEncounterType() throws Exception {
final String newName = "updated name";
SimpleObject encounterType = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.openmrs.module.webservices.rest.test.Util;
import org.openmrs.module.webservices.rest.web.RestTestConstants1_8;
import org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceControllerTest;
import org.openmrs.web.controller.encounter.LocationTagController;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;

Expand Down Expand Up @@ -108,7 +109,7 @@ public void shouldListAll() throws Exception {

}

@Test
@Test(expected = RuntimeException.class)
public void shouldUpdateLocationTag() throws Exception {

final String editedName = "Location Tag edited";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

import java.util.Date;
import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Before;
Expand Down Expand Up @@ -108,7 +106,7 @@ public void shouldCreateAPatientIdentifierType() throws Exception {
assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditingAPatientIdentifierType() throws Exception {
final String newName = "updated name";
SimpleObject patientIdentifierType = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;

import java.util.List;
import java.util.Date;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
Expand Down Expand Up @@ -108,7 +110,7 @@ public void getPersonAttributeType_shouldGetAFullRepresentationOfAPersonAttribut
* @throws Exception
* @verifies change a property on a person
*/
@Test
@Test(expected = RuntimeException.class)
public void updatePersonAttributeType_shouldChangeAPropertyOnAPersonAttributeType() throws Exception {

final String newDescription = "Updated description";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void shouldCreateAPrivilege() throws Exception {
assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditingAPrivilege() throws Exception {
final String newDescription = "updated descr";
SimpleObject privilege = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8;

import java.util.List;
import java.util.Date;

import javax.servlet.http.HttpServletResponse;

Expand Down Expand Up @@ -126,7 +125,7 @@ public void getRole_shouldGetAFullRepresentationOfARole() throws Exception {
* HttpServletResponse)
* @verifies change a property on a Role
*/
@Test
@Test(expected = RuntimeException.class)
public void updateRole_shouldChangeAPropertyOnARole() throws Exception {

final String editedDescription = "Role description edited";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Before;
Expand All @@ -24,10 +28,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

/**
* Tests CRUD operations for {@link ConceptMapType}s via web service calls
*/
Expand Down Expand Up @@ -105,7 +105,7 @@ public void shouldCreateAConceptMapType() throws Exception {
assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditingAConceptMapType() throws Exception {
final String newName = "updated name";
SimpleObject conceptMapTypeType = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import org.apache.commons.beanutils.BeanUtils;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;

import java.util.List;

import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.ConceptReferenceTerm;
Expand All @@ -28,23 +39,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;
import java.util.Map;

import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.hasValue;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;

/**
* Tests CRUD operations for {@link ConceptReferenceTerm}s via web service calls
*/
Expand Down Expand Up @@ -110,7 +104,7 @@ public void shouldCreateAConceptReferenceTerm() throws Exception {
assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditingAConceptReferenceTerm() throws Exception {
final String newCode = "updated code";
SimpleObject conceptReferenceTermType = new SimpleObject();
Expand Down Expand Up @@ -280,7 +274,7 @@ public void shouldFindByCodeOrNameEqualCodeWithLimit() throws Exception {

@Test(expected = InvalidSearchException.class)
public void shouldThrowExceptionWhenSearchTypeIsInvalid() throws Exception {
SimpleObject result = deserialize(handle(newGetRequest(getURI(), new Parameter("source",
deserialize(handle(newGetRequest(getURI(), new Parameter("source",
"Some Standardized Terminology"), new Parameter("codeOrName", "WGT"), new Parameter("searchType", "invalid"))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void shouldCreateADrug() throws Exception {

}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditADrug() throws Exception {

final String editedName = "Aspirin Edited";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Before;
Expand All @@ -24,9 +27,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
* Tests functionality of {@link EncounterRoleController}.
*/
Expand Down Expand Up @@ -93,7 +93,7 @@ public void shouldCreateAEncounterRole() throws Exception {
assertEquals(originalCount + 1, getAllCount());
}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditingAnEncounterRole() throws Exception {
final String newName = "updated name";
SimpleObject encounterRole = new SimpleObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.PropertyUtils;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -23,9 +27,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.request.WebRequest;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class LocationAttributeTypeController1_9Test extends MainResourceControllerTest {

/**
Expand Down Expand Up @@ -75,7 +76,7 @@ public void createLocationAttributeType_shouldCreateANewLocationAttributeType()
* @see LocationAttributeTypeController#updateLocationAttributeType(LocationAttributeType,SimpleObject,WebRequest)
* @verifies change a property on a location
*/
@Test
@Test(expected = RuntimeException.class)
public void updateLocationAttributeType_shouldChangeAPropertyOnALocationAttributeType() throws Exception {
String json = "{\"description\":\"Updated description\"}";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
*/
package org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import java.util.Collection;
import java.util.List;

import org.apache.commons.beanutils.PropertyUtils;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
Expand All @@ -27,9 +31,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.bind.annotation.RequestMethod;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
* Tests functionality of {@link LocationController}.
*/
Expand Down Expand Up @@ -124,7 +125,7 @@ public void shouldCreateALocation() throws Exception {

}

@Test
@Test(expected = RuntimeException.class)
public void shouldEditALocation() throws Exception {

final String editedName = "Xanadu edited";
Expand All @@ -143,7 +144,7 @@ public void shouldEditALocation() throws Exception {
* See RESTWS-418 - Allow REST POST requests to accept un-updatable properties if they haven't
* been updated
*/
@Test
@Test(expected = RuntimeException.class)
public void shouldAllowYouToPostANonUpdatablePropertyWithAnUnchangedValue() throws Exception {
MockHttpServletRequest get = request(RequestMethod.GET, getURI() + "/" + getUuid());
SimpleObject location = deserialize(handle(get));
Expand All @@ -156,7 +157,7 @@ public void shouldAllowYouToPostANonUpdatablePropertyWithAnUnchangedValue() thro
assertThat(updatedLocation.getName(), is("New York"));
}

@Test
@Test(expected = RuntimeException.class)
public void shouldOverwriteAListOfChildLocations() throws Exception {

Location location = service.getLocationByUuid(getUuid());
Expand Down Expand Up @@ -190,7 +191,7 @@ public void shouldRetireALocation() throws Exception {

}

@Test
@Test(expected = RuntimeException.class)
public void shouldUnretireALocation() throws Exception {

Location location = service.getLocation(3);
Expand Down
Loading

0 comments on commit 50efd1a

Please sign in to comment.