    @Test
    public void testHandleCreated() throws Exception {

        FeeId feeId = new FeeId();
        FeeStatus feeStatus = FeeStatus.PENDING;
        BigMoney amount = BigMoney.parse("BTC 30");
        FeeType feeType = FeeType.PAY_COIN;
        Date dueDate = new Date();
        Date businessCreationTime = new Date();
        String portfolioId = "portfolioId";
        String userId = "userId";
        BusinessType businessType = BusinessType.CHARGE_COIN_COMMISSION;
        String businessReferenceId = "businessReferenceId";

        AccountReceivableEntryListener listener = new AccountReceivableEntryListener();

        AccountReceivableFeeEntryQueryRepository repository = mock(AccountReceivableFeeEntryQueryRepository.class);
        listener.setRepository(repository);

        AccountReceivableFeeCreatedEvent event =
                new AccountReceivableFeeCreatedEvent(feeId, feeStatus, amount, feeType, dueDate, businessCreationTime, portfolioId, userId, businessType, businessReferenceId);
        listener.handleCreated(event);

        ArgumentCaptor<AccountReceivableFeeEntry> captor = ArgumentCaptor.forClass(AccountReceivableFeeEntry.class);
        verify(repository).save(captor.capture());

//        AccountReceivableFeeEntry entity = captor.getValue();
        AccountReceivableFeeEntry entity = captor.getValue();

        assertThat(entity.getPrimaryKey(), equalTo(feeId.toString()));
        assertThat(entity.getFeeStatus(), is(FeeStatus.PENDING));
        assertThat(entity.getAmount(), equalTo(amount));
        assertThat(entity.getFeeType(), equalTo(feeType));
        assertThat(entity.getDueDate(), equalTo(dueDate));
        assertThat(entity.getBusinessCreationTime(), equalTo(businessCreationTime));
        assertThat(entity.getPortfolioId(), equalTo(portfolioId));
        assertThat(entity.getUserId(), equalTo(userId));
        assertThat(entity.getBusinessType(), equalTo(businessType));
        assertThat(entity.getBusinessReferenceId(), equalTo(businessReferenceId));
    }