Source:
public void shouldCreateAMandateSuccessfullyWithoutReference() { Account account = new Account("9ddfcc27-acf5-43f9-92d5-52247540714b", TokenPaymentType.DIRECT_DEBIT); MandateConnectorRequest mandateConnectorRequest = new MandateConnectorRequest( "<LINK_0>", AgreementType.ON_DEMAND, null ); Response connectorResponse = agreementService.createMandate(account, mandateConnectorRequest); MandateConnectorResponse mandateConnectorResponse = connectorResponse.readEntity(MandateConnectorResponse.class); assertThat(mandateConnectorResponse.getMandateId(), is(MANDATE_ID)); assertThat(mandateConnectorResponse.getMandateType(), is(MandateType.ON_DEMAND)); assertThat(mandateConnectorResponse.getCreatedDate(), is("2016-01-01T12:00:00.000Z")); assertThat(mandateConnectorResponse.getReturnUrl(), is("<LINK_0>")); assertThat(mandateConnectorResponse.getState(), is(new MandateState("created", false))); assertThat(mandateConnectorResponse.getLinks().get(0), is(new PaymentConnectorResponseLink( "self", "http://localhost:1234/v1/api/accounts/9ddfcc27-acf5-43f9-92d5-52247540714b/mandates/" + MANDATE_ID, "GET", null, null ))); assertThat(mandateConnectorResponse.getLinks().get(1), is(new PaymentConnectorResponseLink( "next_url", "http://frontend_direct_debit/secure/token_1234567asdf", "GET", null, null ))); assertThat(mandateConnectorResponse.getLinks().get(2), is(new PaymentConnectorResponseLink( "next_url_post", "http://frontend_direct_debit/secure/", "POST", "application/x-www-form-urlencoded", Collections.singletonMap("chargeTokenId", "token_1234567asdf") ))); }

Target:
public void shouldCreateAMandateSuccessfullyWithoutReference() { Account account = new Account("9ddfcc27-acf5-43f9-92d5-52247540714b", TokenPaymentType.DIRECT_DEBIT); MandateConnectorRequest mandateConnectorRequest = new MandateConnectorRequest( "<LINK_0>", AgreementType.ON_DEMAND, null ); Response connectorResponse = agreementService.createMandate(account, mandateConnectorRequest); MandateConnectorResponse mandateConnectorResponse = connectorResponse.readEntity(MandateConnectorResponse.class); assertThat(mandateConnectorResponse.getMandateId(), is(MANDATE_ID)); assertThat(mandateConnectorResponse.getMandateType(), is(MandateType.ON_DEMAND)); assertThat(mandateConnectorResponse.getServiceReference(), is(nullValue())); assertThat(mandateConnectorResponse.getCreatedDate(), is("2016-01-01T12:00:00.000Z")); assertThat(mandateConnectorResponse.getReturnUrl(), is("<LINK_0>")); assertThat(mandateConnectorResponse.getState(), is(new MandateState("created", false))); assertThat(mandateConnectorResponse.getLinks().get(0), is(new PaymentConnectorResponseLink( "self", "http://localhost:1234/v1/api/accounts/9ddfcc27-acf5-43f9-92d5-52247540714b/mandates/" + MANDATE_ID, "GET", null, null ))); assertThat(mandateConnectorResponse.getLinks().get(1), is(new PaymentConnectorResponseLink( "next_url", "http://frontend_direct_debit/secure/token_1234567asdf", "GET", null, null ))); assertThat(mandateConnectorResponse.getLinks().get(2), is(new PaymentConnectorResponseLink( "next_url_post", "http://frontend_direct_debit/secure/", "POST", "application/x-www-form-urlencoded", Collections.singletonMap("chargeTokenId", "token_1234567asdf") ))); }