Source:
<code>public void testParametersHandling() throws Exception { OperationContext ctx = new OperationContext(session); Map<String, Serializable> params = new HashMap<>(); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertTrue(e.getMessage().contains("Failed to inject parameter 'action'")); } params.put("action", "foobar"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (NuxeoException e) { <START> assertTrue(e.getStatusCode() == HttpServletResponse.SC_NOT_FOUND); <END> } params.put("action", SetPropertiesAction.ACTION_NAME); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertTrue(e.getMessage().equals("Query and ProviderName cannot be both null")); } params.put("query", "SELECT * FROM Document"); service.run(ctx, BulkRunAction.ID, params); params.put("query", "SELECT * FROM Document where ecm:parentId=?"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertTrue(e.getMessage().equals("Query parameters could not be parsed")); } params.remove("query"); params.put("providerName", "unknow provider name"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertTrue(e.getMessage().equals("Could not get Provider Definition from either query or provider name")); } params.put("providerName", "simpleProviderTest1"); service.run(ctx, BulkRunAction.ID, params); params.put("query", "SELECT * FROM Document"); params.put("params", "foobar"); service.run(ctx, BulkRunAction.ID, params); }</code><technical_language>assertEquals</technical_language>

Target:
public void testParametersHandling() throws Exception { OperationContext ctx = new OperationContext(session); Map<String, Serializable> params = new HashMap<>(); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertTrue(e.getMessage().contains("Failed to inject parameter 'action'")); } params.put("action", "foobar"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (NuxeoException e) { assertEquals(HttpServletResponse.SC_NOT_FOUND, e.getStatusCode()); } params.put("action", SetPropertiesAction.ACTION_NAME); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertEquals("Query and ProviderName cannot be both null", e.getMessage()); } params.put("query", "SELECT * FROM Document"); service.run(ctx, BulkRunAction.ID, params); params.put("query", "SELECT * FROM Document where ecm:parentId=?"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertEquals("Query parameters could not be parsed", e.getMessage()); } params.remove("query"); params.put("providerName", "unknow provider name"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertEquals("Could not get Provider Definition from either query or provider name", e.getMessage()); } params.put("providerName", "simpleProviderTest1"); service.run(ctx, BulkRunAction.ID, params); params.put("query", "SELECT * FROM Document"); params.put("parameters", "foobar"); try { service.run(ctx, BulkRunAction.ID, params); fail("Expected exception"); } catch (OperationException e) { assertEquals("Could not parse parameters, expecting valid json value", e.getMessage()); } }