diff --git a/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java b/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java index 03be2caddc..9e9ef08d26 100644 --- a/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java +++ b/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/ModuleController1_8Test.java @@ -102,7 +102,46 @@ public void shouldIncludeVersionToDefaultRepresentation() throws Exception { Assert.assertNotNull(PropertyUtils.getProperty(result, "version")); } + + @Test + public void shouldGetAFullRepresentation() throws Exception { + MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); + req.addParameter("v", "full"); + SimpleObject result = deserialize(handle(req)); + + Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "display")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "name")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "description")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "packageName")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "author")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "version")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "started")); + } + + @Test + public void shouldGetADefaultRepresentation() throws Exception { + MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); + SimpleObject result = deserialize(handle(req)); + Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "display")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "name")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "description")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "version")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "started")); + } + + @Test + public void shouldGetARefRepresentation() throws Exception { + MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + getUuid()); + req.addParameter("v", "ref"); + SimpleObject result = deserialize(handle(req)); + + Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid")); + Assert.assertNotNull(PropertyUtils.getProperty(result, "display")); + } + @Test public void shouldUploadModule() throws Exception { byte[] fileData = IOUtils.toByteArray(getClass().getClassLoader().getResourceAsStream("mockModule.omod"));