mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
start testing MyProposalListService.
This commit is contained in:
parent
d62d440068
commit
ac6068b728
4 changed files with 39 additions and 4 deletions
|
@ -42,7 +42,7 @@ import javax.annotation.Nullable;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
@Getter
|
@Getter
|
||||||
public final class PubKeyRing implements NetworkPayload, UsedForTradeContractJson {
|
public class PubKeyRing implements NetworkPayload, UsedForTradeContractJson {
|
||||||
private final byte[] signaturePubKeyBytes;
|
private final byte[] signaturePubKeyBytes;
|
||||||
private final byte[] encryptionPubKeyBytes;
|
private final byte[] encryptionPubKeyBytes;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -32,7 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public final class PeriodService {
|
public class PeriodService {
|
||||||
private final DaoStateService daoStateService;
|
private final DaoStateService daoStateService;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -239,8 +239,8 @@ public class MyProposalListService implements PersistedDataHost, DaoStateListene
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canRemoveProposal(Proposal proposal, DaoStateService daoStateService, PeriodService periodService) {
|
private boolean canRemoveProposal(Proposal proposal, DaoStateService daoStateService, PeriodService periodService) {
|
||||||
boolean inPhase = periodService.isInPhase(daoStateService.getChainHeight(), DaoPhase.Phase.PROPOSAL);
|
boolean inProposalPhase = periodService.isInPhase(daoStateService.getChainHeight(), DaoPhase.Phase.PROPOSAL);
|
||||||
return isMine(proposal) && inPhase;
|
return isMine(proposal) && inProposalPhase;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package bisq.core.dao.governance.proposal;
|
||||||
|
|
||||||
|
import bisq.core.btc.wallet.WalletsManager;
|
||||||
|
import bisq.core.dao.governance.period.PeriodService;
|
||||||
|
import bisq.core.dao.state.DaoStateService;
|
||||||
|
|
||||||
|
import bisq.network.p2p.P2PService;
|
||||||
|
|
||||||
|
import bisq.common.crypto.KeyRing;
|
||||||
|
import bisq.common.crypto.PubKeyRing;
|
||||||
|
import bisq.common.storage.Storage;
|
||||||
|
|
||||||
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
public class MyProposalListServiceTest {
|
||||||
|
@Test
|
||||||
|
public void canInstantiate() {
|
||||||
|
KeyRing keyring = mock(KeyRing.class);
|
||||||
|
when(keyring.getPubKeyRing()).thenReturn(mock(PubKeyRing.class));
|
||||||
|
P2PService p2PService = mock(P2PService.class);
|
||||||
|
when(p2PService.getNumConnectedPeers()).thenReturn(new SimpleIntegerProperty(0));
|
||||||
|
Storage storage = mock(Storage.class);
|
||||||
|
MyProposalListService service = new MyProposalListService(p2PService,
|
||||||
|
mock(DaoStateService.class),
|
||||||
|
mock(PeriodService.class), mock(WalletsManager.class), storage, keyring
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue