@Override
    public TaskView toTaskView(String responseBody) {
        ArrayList<String> exceptions = new ArrayList<>();
        try {
            final Map map = (Map) GSON.fromJson(responseBody, Object.class);
            if (map.isEmpty()) {
                exceptions.add("The Json for Task View cannot be empty");
            } else {
                if (!(map.containsKey("displayValue") && map.get("displayValue") instanceof String)) {
                    exceptions.add("The Json for Task View must contain a not-null 'displayValue' of type String");
                }
                if (!(map.containsKey("template") && map.get("template") instanceof String)) {
                    exceptions.add("The Json for Task View must contain a not-null 'template' of type String");
                }
            }
            if (!exceptions.isEmpty()) {
                throw new RuntimeException(StringUtils.join(exceptions, ", "));
            }
            return new TaskView() {
                @Override
                public String displayValue() {
                    return (String) map.get("displayValue");
                }

                @Override
                public String template() {
                    return (String) map.get("template");
                }
            };
        } catch (Exception e) {
            LOGGER.error("Error occurred while converting the Json to Task View. Error: {}. The Json received was '{}'.", e.getMessage(), responseBody);
            throw new RuntimeException(String.format("Error occurred while converting the Json to Task View. Error: %s.", e.getMessage()));
        }
    }
@Test
    public void shouldCreateTaskViewFromResponse() {
        String jsonResponse = "{\"displayValue\":\"MyTaskPlugin\", \"template\":\"<html>junk</html>\"}";

        TaskView view = new JsonBasedTaskExtensionHandler_V1().toTaskView(jsonResponse);

       assertThat(view.displayValue(), is("MyTaskPlugin"));
       assertThat(view.template(), is("<html>junk</html>"));
    }