@Test public void testFromJSON() throws IOException { // Json representation of an UserStory object, which equals userstory String jsonString = "{\"id\":0,\"title\":\"Story1\",\"description\":\"An userstory\",\"tasks\":[{\"id\":0,\"title\":\"Task1\",\"priority\":\"HIGH\",\"status\":\"TODO\",\"description\":\"\",\"inCharge\":\"\"},{\"id\":1,\"title\":\"Task2\",\"priority\":\"HIGH\",\"status\":\"TODO\",\"description\":\"\",\"inCharge\":\"\"},{\"id\":2,\"title\":\"Task3\",\"priority\":\"MIDDLE\",\"status\":\"TODO\",\"description\":\"\",\"inCharge\":\"\"},{\"id\":3,\"title\":\"Task4\",\"priority\":\"LOW\",\"status\":\"TODO\",\"description\":\"\",\"inCharge\":\"\"},{\"id\":4,\"title\":\"Task5\",\"priority\":\"VERY_LOW\",\"status\":\"TODO\",\"description\":\"\",\"inCharge\":\"\"}],\"priority\":\"HIGH\"}"; UserStory userstoryFromJson = UserStory.fromJson(jsonString); assertTrue(userstory.equals(userstoryFromJson)); }
@Test(expected = JsonMappingException.class) public void testFromJSONException() throws IOException { UserStory userstoryFromJson = UserStory.fromJson("{\"test\":\"test\"}"); }