Search in sources :

Example 1 with PluginsProperties

use of io.nem.symbol.sdk.model.network.PluginsProperties in project nem2-sdk-java by nemtech.

the class AggregateTransactionServiceTest method getNetworkMaxCosignaturesPerAggregateWhenValidInvalid.

@Test
void getNetworkMaxCosignaturesPerAggregateWhenValidInvalid() {
    NetworkConfiguration configuration = Mockito.mock(NetworkConfiguration.class);
    PluginsProperties pluginsProperties = Mockito.mock(PluginsProperties.class);
    AggregateNetworkProperties aggregateNetworkProperties = Mockito.mock(AggregateNetworkProperties.class);
    Mockito.when(pluginsProperties.getAggregate()).thenReturn(aggregateNetworkProperties);
    Mockito.when(configuration.getPlugins()).thenReturn(pluginsProperties);
    Mockito.when(networkRepository.getNetworkProperties()).thenReturn(Observable.just(configuration));
    IllegalStateException exception = Assertions.assertThrows(IllegalStateException.class, () -> ExceptionUtils.propagate(() -> service.getNetworkMaxCosignaturesPerAggregate().toFuture().get()));
    Assertions.assertEquals("Cannot get maxCosignaturesPerAggregate from network properties.", exception.getMessage());
}
Also used : PluginsProperties(io.nem.symbol.sdk.model.network.PluginsProperties) AggregateNetworkProperties(io.nem.symbol.sdk.model.network.AggregateNetworkProperties) NetworkConfiguration(io.nem.symbol.sdk.model.network.NetworkConfiguration) Test(org.junit.jupiter.api.Test)

Example 2 with PluginsProperties

use of io.nem.symbol.sdk.model.network.PluginsProperties in project nem2-sdk-java by nemtech.

the class AggregateTransactionServiceTest method getNetworkMaxCosignaturesPerAggregateWhenValid.

@Test
void getNetworkMaxCosignaturesPerAggregateWhenValid() throws ExecutionException, InterruptedException {
    NetworkConfiguration configuration = Mockito.mock(NetworkConfiguration.class);
    PluginsProperties pluginsProperties = Mockito.mock(PluginsProperties.class);
    AggregateNetworkProperties aggregateNetworkProperties = Mockito.mock(AggregateNetworkProperties.class);
    Mockito.when(aggregateNetworkProperties.getMaxCosignaturesPerAggregate()).thenReturn("25");
    Mockito.when(pluginsProperties.getAggregate()).thenReturn(aggregateNetworkProperties);
    Mockito.when(configuration.getPlugins()).thenReturn(pluginsProperties);
    Mockito.when(networkRepository.getNetworkProperties()).thenReturn(Observable.just(configuration));
    Integer maxCosignaturesPerAggregate = service.getNetworkMaxCosignaturesPerAggregate().toFuture().get();
    Assertions.assertEquals(25, maxCosignaturesPerAggregate);
}
Also used : BigInteger(java.math.BigInteger) PluginsProperties(io.nem.symbol.sdk.model.network.PluginsProperties) AggregateNetworkProperties(io.nem.symbol.sdk.model.network.AggregateNetworkProperties) NetworkConfiguration(io.nem.symbol.sdk.model.network.NetworkConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

AggregateNetworkProperties (io.nem.symbol.sdk.model.network.AggregateNetworkProperties)2 NetworkConfiguration (io.nem.symbol.sdk.model.network.NetworkConfiguration)2 PluginsProperties (io.nem.symbol.sdk.model.network.PluginsProperties)2 Test (org.junit.jupiter.api.Test)2 BigInteger (java.math.BigInteger)1