@Test
public void testWithValidUser() throws Exception {

    final Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("id", VALID_ANALYSIS_ID.toString());
    final ActionParameters params = createActionParams(parameters, getLoggedInUser());
    handler.handlePost(params);
    try {
        verify(service, times(1)).deleteAnalysis(analysisValid);
    } catch (MockitoAssertionError e) {
        // catch and throw to make a more meaningful fail message
        throw new MockitoAssertionError("Was expecting delete to have been called with valid analysis object");
    }
}