TaxReceiptMobileController extends AbstractController { @RequestMapping(value = "/fe/taxreceipts/manual/donate") public ResponseEntity<String> manualDonate( @RequestParam(value = "cnpj") String cnpj , @RequestParam(value = "date") Date date , @RequestParam(value = "coo") String coo , @RequestParam(value = "total") double total) { HttpHeaders responseHeaders = super.createBasicHttpHeaderResponse(APPLICATION_JSON); Gson gson = new Gson(); ResultResponse resultResponse; try { Assert.isTrue(StringUtils.validateCNPJ(cnpj)); Assert.notNull(coo); Assert.isTrue(StringUtils.isNumeric(coo)); Assert.isTrue(total > 0); TaxReceipt taxReceipt = new TaxReceipt(); taxReceipt.setCnpj(removeNonNumeric(cnpj)); taxReceipt.setDate(date); taxReceipt.setCoo(coo); taxReceipt.setTotal(total); taxReceipt.setDateInsertion(new Date()); taxReceiptDAO.save(taxReceipt); resultResponse = new ResultResponse(true); } catch (Exception ex) { ex.printStackTrace(); resultResponse = new ResultResponse(false); } return new ResponseEntity<>(gson.toJson(resultResponse), responseHeaders, HttpStatus.OK); }  @RequestMapping(value = "/fe/taxreceipts/process/auth", method = RequestMethod.POST) ResponseEntity<String> auth(); @RequestMapping(value = "/fe/taxreceipts/process/start", method = RequestMethod.POST) ResponseEntity<String> start(@RequestParam(value = "base64Image", required = true) final String base64Image,
                                        @RequestParam(value = "transactionId", required = true) final String transactionId,
                                        @RequestParam(value = "counterSignature", required = true) final String counterSignature); @RequestMapping(value = "/fe/taxreceipts/process/check", method = RequestMethod.POST) ResponseEntity<String> check(@RequestParam(value = "transactionId", required = true) final String transactionId,
                                        @RequestParam(value = "counterSignature", required = true) final String counterSignature); @RequestMapping(value = "/fe/taxreceipts/process/donate") ResponseEntity<String> processDonate(
            @RequestParam(value = "cnpj") String cnpj
            , @RequestParam(value = "date") Date date
            , @RequestParam(value = "coo") String coo
            , @RequestParam(value = "total") double total
            , @RequestParam(value = "transactionId") String transactionId); @RequestMapping(value = "/fe/taxreceipts/manual/donate") ResponseEntity<String> manualDonate(
            @RequestParam(value = "cnpj") String cnpj
            , @RequestParam(value = "date") Date date
            , @RequestParam(value = "coo") String coo
            , @RequestParam(value = "total") double total);  }
@Test public void testManualDonate() throws Exception { ResultResponse resultResponse; resultResponse = manualDonate(new TaxReceipt("47.508.411/0285-90", new Date(), "123456", 0.01)); MatcherAssert.assertThat(resultResponse.isSuccess(), equalTo(Boolean.TRUE)); resultResponse = manualDonate(new TaxReceipt("47.508.411/0285-90", new Date(), "123456", 0.00)); MatcherAssert.assertThat(resultResponse.isSuccess(), equalTo(Boolean.FALSE)); resultResponse = manualDonate(new TaxReceipt("47.508.411/0285-91", new Date(), "123456", -0.00)); MatcherAssert.assertThat(resultResponse.isSuccess(), equalTo(Boolean.FALSE)); }