Skip to content

Commit

Permalink
Added some test cases for moduleController1_8
Browse files Browse the repository at this point in the history
Added some test cases for moduleController1_8
  • Loading branch information
suthagar23 committed Aug 9, 2017
1 parent 7a39d69 commit e26e3d8
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit e26e3d8

Please sign in to comment.