use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountRepositoryIntegrationTest method getTransactionById.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getTransactionById(RepositoryType type) {
TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
Account account = config().getDefaultAccount();
List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).signerPublicKey(account.getPublicAccount().getPublicKey()).pageSize(10))).getData();
Assertions.assertTrue(transactions.size() > 0);
String id = transactions.get(1).getTransactionInfo().get().getId().get();
List<Transaction> transactions2 = get(transactionRepository.getTransactions(TransactionGroup.CONFIRMED, Arrays.asList(id)));
Assertions.assertEquals(1, transactions2.size());
transactions2.forEach(t -> Assertions.assertEquals(id, t.getTransactionInfo().get().getId().get()));
}
use of org.junit.jupiter.params.provider.EnumSource in project nem2-sdk-java by nemtech.
the class AccountMetadataIntegrationTest method addMetadataToAccount.
@ParameterizedTest
@EnumSource(RepositoryType.class)
public void addMetadataToAccount(RepositoryType type) {
BigInteger key = SerializationUtils.toUnsignedBigInteger(RandomUtils.generateRandomInt(100000) + Long.MAX_VALUE);
Assertions.assertTrue(key.compareTo(BigInteger.ZERO) > 0);
System.out.println("Key: " + key);
String message = "This is the message for this account! 汉字" + key;
System.out.println("Storing message '" + message + "' in account metadata " + testAccount.getAddress().plain());
AccountMetadataTransaction transaction = AccountMetadataTransactionFactory.create(getNetworkType(), getDeadline(), testAccount.getAddress(), key, StringEncoder.getBytes(message)).maxFee(maxFee).build();
AccountMetadataTransaction processedTransaction = announceAggregateAndValidate(type, transaction, testAccount).getLeft();
Assertions.assertEquals(transaction.getValueSizeDelta(), processedTransaction.getValueSizeDelta());
Assertions.assertEquals(transaction.getScopedMetadataKey(), processedTransaction.getScopedMetadataKey());
sleep(1000);
Metadata metadata = assertMetadata(transaction, get(getRepositoryFactory(type).createMetadataRepository().search(new MetadataSearchCriteria().metadataType(MetadataType.ACCOUNT).sourceAddress(testAccount.getAddress()))).getData());
assertMetadata(transaction, get(getRepositoryFactory(type).createMetadataRepository().search(new MetadataSearchCriteria().metadataType(MetadataType.ACCOUNT).sourceAddress(testAccount.getAddress()).scopedMetadataKey(metadata.getScopedMetadataKey()))).getData());
assertMetadata(transaction, get(getRepositoryFactory(type).createMetadataRepository().search(new MetadataSearchCriteria().metadataType(MetadataType.ACCOUNT).sourceAddress(testAccount.getAddress()).targetAddress(testAccount.getAddress()).scopedMetadataKey(metadata.getScopedMetadataKey()))).getData());
Assertions.assertArrayEquals(StringEncoder.getBytes(message), processedTransaction.getValue());
}
use of org.junit.jupiter.params.provider.EnumSource in project litiengine by gurkenlabs.
the class EnvironmentTests method testEntityByRenderType.
@ParameterizedTest
@EnumSource(RenderType.class)
void testEntityByRenderType(RenderType renderType) {
ICombatEntity entity = mock(ICombatEntity.class);
when(entity.getMapId()).thenReturn(123);
when(entity.getName()).thenReturn("test");
when(entity.getRenderType()).thenReturn(renderType);
when(entity.getCollisionType()).thenReturn(Collision.DYNAMIC);
this.testEnvironment.add(entity);
assertNotNull(this.testEnvironment.get(123));
assertNotNull(this.testEnvironment.get("test"));
assertEquals(1, this.testEnvironment.getEntities(renderType).size());
this.testEnvironment.remove(entity);
assertNull(this.testEnvironment.get(123));
assertNull(this.testEnvironment.get("test"));
assertEquals(0, this.testEnvironment.getEntities(renderType).size());
}
use of org.junit.jupiter.params.provider.EnumSource in project reactor-core by reactor.
the class FluxCreateTest method secondOnCancelHandlerIsDisposedImmediately.
@ParameterizedTestWithName
@EnumSource(OverflowStrategy.class)
void secondOnCancelHandlerIsDisposedImmediately(OverflowStrategy overflowStrategy) {
AtomicInteger firstDisposed = new AtomicInteger();
AtomicInteger secondDisposed = new AtomicInteger();
Flux.create(sink -> sink.onCancel(firstDisposed::incrementAndGet).onCancel(secondDisposed::incrementAndGet), overflowStrategy).subscribe();
assertThat(firstDisposed).as("first handler for %s", overflowStrategy).hasValue(0);
assertThat(secondDisposed).as("second handler for %s", overflowStrategy).hasValue(1);
}
use of org.junit.jupiter.params.provider.EnumSource in project aeron by real-logic.
the class ArchiveTest method replayBufferReturnsDataBufferIfThreadingModeIsNotDEDICATED.
@ParameterizedTest
@EnumSource(value = ArchiveThreadingMode.class, mode = EXCLUDE, names = "DEDICATED")
void replayBufferReturnsDataBufferIfThreadingModeIsNotDEDICATED(final ArchiveThreadingMode threadingMode) {
final Archive.Context context = new Archive.Context().threadingMode(threadingMode);
final UnsafeBuffer buffer = context.replayBuffer();
assertSame(context.dataBuffer(), buffer);
}
Aggregations