### Question:
JsonConverter { public RequestBlock fromJson(String request) { Validate.notNull(request); try { return gson.fromJson(request, RequestBlock.class); } catch (NullPointerException | IllegalArgumentException | JsonSyntaxException e) { throw new IllegalArgumentException(e); } } JsonConverter(); String toJson(ResponseBlock response); RequestBlock fromJson(String request);  }### Answer:
@Test public void mustConvertJsonStringToRequestBlock() { String json = "{\n" + " id: 'hi',\n" + " outQueueOffset: 2," + " inQueueOffset: 3," + " inQueue: [\n" + " {\n" + " source='a:a1',\n" + " destination='b:b1',\n" + " type='java.lang.String',\n" + " data='payload1'\n" + " },\n" + " {\n" + " source='a:a2',\n" + " destination='b:b2',\n" + " type='java.lang.String',\n" + " data='payload2'\n" + " }\n" + " ]\n" + "}"; RequestBlock rb = fixture.fromJson(json); assertEquals("hi", rb.getId()); assertEquals(2, rb.getOutQueueOffset()); assertEquals(3, rb.getInQueueOffset()); assertEquals(2, rb.getInQueue().size()); assertEquals("a:a1", rb.getInQueue().get(0).getSourceAddress().toString()); assertEquals("b:b1", rb.getInQueue().get(0).getDestinationAddress().toString()); assertEquals("payload1", rb.getInQueue().get(0).getMessage()); assertEquals("a:a2", rb.getInQueue().get(1).getSourceAddress().toString()); assertEquals("b:b2", rb.getInQueue().get(1).getDestinationAddress().toString()); assertEquals("payload2", rb.getInQueue().get(1).getMessage()); }