Skip to content

Commit

Permalink
payment account removal issue. Issue #3461
Browse files Browse the repository at this point in the history
  • Loading branch information
beingindot committed Nov 15, 2019
1 parent fb96ad3 commit 93002dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/bisq/core/payment/PaymentAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@

import static com.google.common.base.Preconditions.checkNotNull;

@EqualsAndHashCode
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@ToString
@Getter
@Slf4j
public abstract class PaymentAccount implements PersistablePayload {
protected final PaymentMethod paymentMethod;
@Setter
@EqualsAndHashCode.Include
protected String id;
@Setter
@EqualsAndHashCode.Include
protected long creationDate;
@Setter
public PaymentAccountPayload paymentAccountPayload;
Expand Down
22 changes: 22 additions & 0 deletions core/src/test/java/bisq/core/payment/PaymentAccountsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.offer.Offer;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.user.UserPayload;

import javafx.collections.FXCollections;
import javafx.collections.ObservableSet;

import java.util.Collections;

import org.junit.Test;

import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -71,4 +76,21 @@ private static PaymentAccount createAccountWithAge(AccountAgeWitnessService serv

return account;
}

@Test
public void testRemoveAccount() {
PaymentAccount account = new RevolutAccount();
account.setAccountName("account name");

ObservableSet<PaymentAccount> paymentAccountsAsObservable;
paymentAccountsAsObservable = FXCollections.observableSet(new UserPayload().getPaymentAccounts());

//add element
paymentAccountsAsObservable.add(account);

//remove element with some state change
account.setAccountName("new account name for new hash code");

assertTrue(paymentAccountsAsObservable.remove(account));
}
}

0 comments on commit 93002dc

Please sign in to comment.