@Test public void reject() { mockHelper.reset(); mockHelper.mock("/audit/reject"); JSONObject object = mockHelper.getResponse().asJson(); Assert.assertEquals(9981, object.getIntValue("code")); Assert.assertEquals(message.get(Validators.PREFIX + "empty", message.get(TestAuditModel.NAME + ".ids")), object.getString("message")); Assert.assertNull(auditService.getPassIds()); mockHelper.reset(); mockHelper.getRequest().addParameter("ids", "id1,id2"); mockHelper.mock("/audit/reject"); object = mockHelper.getResponse().asJson(); Assert.assertEquals(9982, object.getIntValue("code")); Assert.assertEquals(message.get(Validators.PREFIX + "empty", message.get(TestAuditModel.NAME + ".auditRemark")), object.getString("message")); Assert.assertNull(auditService.getPassIds()); mockHelper.reset(); mockHelper.getRequest().addParameter("ids", "id1,id2"); mockHelper.getRequest().addParameter("auditRemark", generator.random(101)); mockHelper.mock("/audit/reject"); object = mockHelper.getResponse().asJson(); Assert.assertEquals(9983, object.getIntValue("code")); Assert.assertEquals(message.get(Validators.PREFIX + "over-max-length", message.get(TestAuditModel.NAME + ".auditRemark"), 100), object.getString("message")); Assert.assertNull(auditService.getPassIds()); mockHelper.reset(); mockHelper.getRequest().addParameter("ids", "id1,id2"); mockHelper.getRequest().addParameter("auditRemark", "audit-remark"); mockHelper.mock("/audit/reject"); object = mockHelper.getResponse().asJson(); Assert.assertEquals(9995, object.getIntValue("code")); Assert.assertEquals(message.get(Validators.PREFIX + "illegal-sign"), object.getString("message")); Assert.assertNull(auditService.getRefuseIds()); mockHelper.reset(); mockHelper.getRequest().addParameter("ids", "id1,id2"); mockHelper.getRequest().addParameter("auditRemark", "audit-remark"); sign.put(mockHelper.getRequest().getMap(), null); mockHelper.mock("/audit/reject"); object = mockHelper.getResponse().asJson(); Assert.assertEquals(0, object.getIntValue("code")); Assert.assertEquals("", object.getString("data")); Assert.assertArrayEquals(new String[]{"id1", "id2"}, auditService.getRefuseIds()); Assert.assertEquals("audit-remark", auditService.getAuditRemark()); }
@Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) public Object reject() { getAuditService().reject(request.getAsArray("ids"), request.get("auditRemark")); return ""; }
AuditCtrlSupport extends RecycleCtrlSupport { @Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) public Object reject() { getAuditService().reject(request.getAsArray("ids"), request.get("auditRemark")); return ""; } }
AuditCtrlSupport extends RecycleCtrlSupport { @Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) public Object reject() { getAuditService().reject(request.getAsArray("ids"), request.get("auditRemark")); return ""; }  }
AuditCtrlSupport extends RecycleCtrlSupport { @Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) public Object reject() { getAuditService().reject(request.getAsArray("ids"), request.get("auditRemark")); return ""; }  @Execute(name = "pass", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) Object pass(); @Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) Object reject(); }
AuditCtrlSupport extends RecycleCtrlSupport { @Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) public Object reject() { getAuditService().reject(request.getAsArray("ids"), request.get("auditRemark")); return ""; }  @Execute(name = "pass", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) Object pass(); @Execute(name = "reject", validates = { @Validate(validator = Validators.NOT_EMPTY, parameter = "ids", failureCode = 81), @Validate(validator = Validators.NOT_EMPTY, parameter = "auditRemark", failureCode = 82), @Validate(validator = Validators.MAX_LENGTH, number = {100}, parameter = "auditRemark", failureCode = 83), @Validate(validator = Validators.SIGN) }) Object reject();  }