use of org.assertj.core.api.IterableAssert in project drools-wb by kiegroup.
the class EnumIndexVisitorCDITest method testDependentEnumIndexing.
@Test
public void testDependentEnumIndexing() throws Exception {
final String carFQN = "com.myteam.repro.Car";
final Path testedPath = Paths.get(getClass().getResource("cars/src/main/resources/com/myteam/repro/cars.enumeration").toURI());
final Set<KProperty<?>> properties = indexer.fillIndexBuilder(testedPath).build();
final ModuleDataModelOracle oracle = indexer.getModuleDataModelOracle(testedPath);
Assertions.assertThat(oracle.getModuleModelFields().keySet()).contains(carFQN);
final IterableAssert carFields = Assertions.assertThat(properties).filteredOn("name", "ref:field:" + carFQN);
carFields.filteredOn("value", "price").hasSize(1);
carFields.filteredOn("value", "color").hasSize(1);
final IterableAssert javaClasses = Assertions.assertThat(properties).filteredOn("name", "ref:java");
javaClasses.filteredOn("value", carFQN).hasSize(1);
}
use of org.assertj.core.api.IterableAssert in project hedera-mirror-node by hashgraph.
the class NftRepositoryTest method updateTreasury.
@Test
void updateTreasury() {
long consensusTimestamp = 6L;
EntityId newAccountId = EntityId.of("0.0.2", EntityType.ACCOUNT);
Nft nft1 = nft("0.0.100", 1, 1);
Nft nft2 = nft("0.0.100", 2, 2);
Nft nft3 = nft("0.0.100", 3, 3);
// Not updated since wrong token
Nft nft4 = nft("0.0.101", 1, 4);
// Not updated since wrong account
Nft nft5 = nft("0.0.100", 4, 5);
nft5.setAccountId(newAccountId);
nftRepository.saveAll(List.of(nft1, nft2, nft3, nft4, nft5));
EntityId tokenId = nft1.getId().getTokenId();
EntityId previousAccountId = nft1.getAccountId();
nftRepository.updateTreasury(tokenId.getId(), previousAccountId.getId(), newAccountId.getId(), consensusTimestamp, EntityId.of("0.0.200", EntityType.ACCOUNT).getId(), false);
assertAccountUpdated(nft1, newAccountId);
assertAccountUpdated(nft2, newAccountId);
assertAccountUpdated(nft3, newAccountId);
assertThat(nftRepository.findById(nft4.getId())).get().isEqualTo(nft4);
assertThat(nftRepository.findById(nft5.getId())).get().isEqualTo(nft5);
IterableAssert<NftTransfer> nftTransfers = assertThat(nftTransferRepository.findAll()).hasSize(3);
nftTransfers.extracting(NftTransfer::getReceiverAccountId).containsOnly(newAccountId);
nftTransfers.extracting(NftTransfer::getSenderAccountId).containsOnly(previousAccountId);
nftTransfers.extracting(n -> n.getId().getTokenId()).containsOnly(tokenId);
nftTransfers.extracting(n -> n.getId().getConsensusTimestamp()).containsOnly(consensusTimestamp);
nftTransfers.extracting(n -> n.getId().getSerialNumber()).containsExactlyInAnyOrder(1L, 2L, 3L);
nftTransfers.extracting(NftTransfer::getIsApproval).containsExactlyInAnyOrder(false, false, false);
}
Aggregations