Fix tests

This commit is contained in:
chimp1984 2020-08-29 12:53:35 -05:00
parent 2f291a6acb
commit 9e4e800cb6
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
3 changed files with 60 additions and 33 deletions

View File

@ -28,6 +28,8 @@ import bisq.common.util.Utilities;
import com.google.protobuf.ByteString;
import com.google.common.annotations.VisibleForTesting;
import java.security.PublicKey;
import java.util.List;
@ -176,27 +178,28 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
// PROTO BUFFER
///////////////////////////////////////////////////////////////////////////////////////////
private Filter(List<String> bannedOfferIds,
List<String> bannedNodeAddress,
List<PaymentAccountFilter> bannedPaymentAccounts,
List<String> bannedCurrencies,
List<String> bannedPaymentMethods,
List<String> arbitrators,
List<String> seedNodes,
List<String> priceRelayNodes,
boolean preventPublicBtcNetwork,
List<String> btcNodes,
boolean disableDao,
String disableDaoBelowVersion,
String disableTradeBelowVersion,
List<String> mediators,
List<String> refundAgents,
List<String> bannedSignerPubKeys,
List<String> btcFeeReceiverAddresses,
byte[] ownerPubKeyBytes,
long creationDate,
@Nullable Map<String, String> extraDataMap,
@Nullable String signatureAsBase64) {
@VisibleForTesting
public Filter(List<String> bannedOfferIds,
List<String> bannedNodeAddress,
List<PaymentAccountFilter> bannedPaymentAccounts,
List<String> bannedCurrencies,
List<String> bannedPaymentMethods,
List<String> arbitrators,
List<String> seedNodes,
List<String> priceRelayNodes,
boolean preventPublicBtcNetwork,
List<String> btcNodes,
boolean disableDao,
String disableDaoBelowVersion,
String disableTradeBelowVersion,
List<String> mediators,
List<String> refundAgents,
List<String> bannedSignerPubKeys,
List<String> btcFeeReceiverAddresses,
byte[] ownerPubKeyBytes,
long creationDate,
@Nullable Map<String, String> extraDataMap,
@Nullable String signatureAsBase64) {
this.bannedOfferIds = bannedOfferIds;
this.bannedNodeAddress = bannedNodeAddress;
this.bannedPaymentAccounts = bannedPaymentAccounts;
@ -219,7 +222,12 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
this.extraDataMap = ExtraDataMapValidator.getValidatedExtraDataMap(extraDataMap);
this.signatureAsBase64 = signatureAsBase64;
ownerPubKey = Sig.getPublicKeyFromBytes(ownerPubKeyBytes);
// ownerPubKeyBytes can be null when called from tests
if (ownerPubKeyBytes != null) {
ownerPubKey = Sig.getPublicKeyFromBytes(ownerPubKeyBytes);
} else {
ownerPubKey = null;
}
}
@Override

View File

@ -53,13 +53,15 @@ public class UserPayloadModelVOTest {
false,
null,
null,
"string",
new byte[]{10, 0, 0},
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
null,
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList()));
0,
null,
null));
vo.setRegisteredArbitrator(ArbitratorTest.getArbitratorMock());
vo.setRegisteredMediator(MediatorTest.getMediatorMock());
vo.setAcceptedArbitrators(Lists.newArrayList(ArbitratorTest.getArbitratorMock()));

View File

@ -22,6 +22,7 @@ import bisq.core.dao.governance.param.Param;
import bisq.core.filter.Filter;
import bisq.core.filter.FilterManager;
import com.google.common.collect.Lists;
import com.google.common.primitives.Longs;
import java.util.HashMap;
@ -98,10 +99,26 @@ public class FeeReceiverSelectorTest {
}
private static Filter filterWithReceivers(List<String> btcFeeReceiverAddresses) {
return new Filter(null, null, null, null,
null, null, null, null,
false, null, false, null,
null, null, null, null,
btcFeeReceiverAddresses);
return new Filter(Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
false,
Lists.newArrayList(),
false,
null,
null,
Lists.newArrayList(),
Lists.newArrayList(),
Lists.newArrayList(),
btcFeeReceiverAddresses,
null,
0,
null,
null);
}
}