Source:
public void persist_shouldCreateAnAccount() { final CardTypeEntity masterCardCredit = databaseTestHelper.getMastercardCreditCard(); final CardTypeEntity viseCardDebit = databaseTestHelper.getVisaCreditCard(); createAccountRecordWithCards(); String paymentProvider = "test provider"; GatewayAccountEntity account = new GatewayAccountEntity(paymentProvider, new HashMap<>(), TEST); account.setCardTypes(Arrays.asList(masterCardCredit, viseCardDebit)); gatewayAccountDao.persist(account); assertThat(account.getId(), is(notNullValue())); assertThat(account.getEmailNotifications().isEmpty(), is(true)); assertThat(account.getDescription(), is(nullValue())); assertThat(account.getAnalyticsId(), is(nullValue())); assertThat(account.getNotificationCredentials(), is(nullValue())); assertThat(account.getCorporateCreditCardSurchargeAmount(), is(0L)); assertThat(account.getCorporateDebitCardSurchargeAmount(), is(0L)); databaseTestHelper.getAccountCredentials(account.getId()); List<Map<String, Object>> acceptedCardTypesByAccountId = databaseTestHelper.getAcceptedCardTypesByAccountId(account.getId()); assertThat(acceptedCardTypesByAccountId, containsInAnyOrder( allOf( org.hamcrest.Matchers.hasEntry("label", masterCardCredit.getLabel()), org.hamcrest.Matchers.hasEntry("type", masterCardCredit.getType().toString()), org.hamcrest.Matchers.hasEntry("brand", masterCardCredit.getBrand()) ), allOf( org.hamcrest.Matchers.hasEntry("label", viseCardDebit.getLabel()), org.hamcrest.Matchers.hasEntry("type", viseCardDebit.getType().toString()), org.hamcrest.Matchers.hasEntry("brand", viseCardDebit.getBrand()) ))); }

Target:
public void persist_shouldCreateAnAccount() { final CardTypeEntity masterCardCredit = databaseTestHelper.getMastercardCreditCard(); final CardTypeEntity visaCardDebit = databaseTestHelper.getVisaCreditCard(); createAccountRecordWithCards(); String paymentProvider = "test provider"; GatewayAccountEntity account = new GatewayAccountEntity(paymentProvider, new HashMap<>(), TEST); account.setCardTypes(Arrays.asList(masterCardCredit, visaCardDebit)); gatewayAccountDao.persist(account); assertThat(account.getId(), is(notNullValue())); assertThat(account.getEmailNotifications().isEmpty(), is(true)); assertThat(account.getDescription(), is(nullValue())); assertThat(account.getAnalyticsId(), is(nullValue())); assertThat(account.getNotificationCredentials(), is(nullValue())); assertThat(account.getCorporateCreditCardSurchargeAmount(), is(0L)); assertThat(account.getCorporateDebitCardSurchargeAmount(), is(0L)); assertThat(account.getCorporatePrepaidCreditCardSurchargeAmount(), is(0L)); assertThat(account.getCorporatePrepaidDebitCardSurchargeAmount(), is(0L)); databaseTestHelper.getAccountCredentials(account.getId()); List<Map<String, Object>> acceptedCardTypesByAccountId = databaseTestHelper.getAcceptedCardTypesByAccountId(account.getId()); assertThat(acceptedCardTypesByAccountId, containsInAnyOrder( allOf( hasEntry("label", masterCardCredit.getLabel()), hasEntry("type", masterCardCredit.getType().toString()), hasEntry("brand", masterCardCredit.getBrand()) ), allOf( hasEntry("label", visaCardDebit.getLabel()), hasEntry("type", visaCardDebit.getType().toString()), hasEntry("brand", visaCardDebit.getBrand()) ))); }