### Question:
SubmissionResultParser { public SubmissionResult parseFromJson(String json) { if (json.trim().isEmpty()) { throw new IllegalArgumentException("Empty input"); } try { Gson gson = new GsonBuilder().registerTypeAdapter(SubmissionResult.Status.class, new StatusDeserializer()) .registerTypeAdapter(StackTraceElement.class, new StackTraceSerializer()).create(); return gson.fromJson(json, SubmissionResult.class); } catch (RuntimeException e) { throw new RuntimeException("Failed to parse submission result: " + e.getMessage(), e); } }  SubmissionResult parseFromJson(String json);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void parseFromJsonThrowsWithEmptyArgument() { parser.parseFromJson(""); }
@Test(expected = IllegalArgumentException.class) public void parseFromJsonThrowsWithWhitespaceArgument() { parser.parseFromJson(" "); }
@Test(expected = RuntimeException.class) public void parseFromJsonThrowsRuntimeExceptionOnMalformedJson() { parser.parseFromJson("This is invalid json"); }
@Test public void parseFromJsonReturnsValidObjectWhenDeserializing() { SubmissionResult initial = new SubmissionResult(); initial.setError("Error"); initial.setStatus(Status.OK); List<String> list = new ArrayList<String>(); list.add("1"); list.add("2"); initial.setMissingReviewPoints(list); Gson gson = new Gson(); SubmissionResult result = parser.parseFromJson(gson.toJson(initial)); assertEquals(initial.getError(), result.getError()); assertEquals(initial.getStatus(), result.getStatus()); assertEquals(initial.getMissingReviewPoints(), result.getMissingReviewPoints()); }