@Test
public void testPublishFromTemplateSimpleInput() throws Exception {

    // setup params
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(AppSetupHandler.KEY_PUBDATA, ResourceHelper.readStringResource("AppSetupHandlerTest-input-simple.json", this));
    parameters.put(AppSetupHandler.PARAM_PUBLISHER_VIEW_UUID, VALUE_PARENT_UUID);
    final ActionParameters params = createActionParams(parameters, getLoggedInUser());
    verifyResponseNotWritten(params);
    handler.handlePost(params);
    // test that response was written once
    verifyResponseWritten(params);
    final JSONObject expectedResult = ResourceHelper.readJSONResource("AppSetupHandlerTest-output-simple.json", this);
    final JSONObject actualResponse = getResponseJSON();
    // UUID will change in each run, so just checking that there is one
    assertNotNull("Must contain actual UUID", actualResponse.getString("uuid"));
    actualResponse.remove("uuid");
    expectedResult.remove("uuid");
    // URL will change in each run as it contains the UUID, so just checking that there is one
    assertNotNull("Must contain some URL", actualResponse.getString("url"));
    assertNotNull("URL should start with expected format", actualResponse.getString("url").startsWith("//domain.com/map?lang=fi&" + ActionConstants.PARAM_UUID + "="));
            actualResponse.remove("url");
    expectedResult.remove("url");
    assertTrue("Response should match expected", JSONHelper.isEqual(expectedResult, actualResponse));
}