53
53
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .NO_VALID_MAX_CUSTOM_FEE ;
54
54
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .SUCCESS ;
55
55
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .TOKEN_NOT_ASSOCIATED_TO_ACCOUNT ;
56
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
56
57
import static org .junit .jupiter .api .Assertions .assertTrue ;
57
58
58
59
import com .hedera .services .bdd .junit .HapiTest ;
67
68
import com .hederahashgraph .api .proto .java .ResponseCodeEnum ;
68
69
import com .hederahashgraph .api .proto .java .TokenID ;
69
70
import com .hederahashgraph .api .proto .java .TokenType ;
71
+ import com .hederahashgraph .api .proto .java .TransactionRecord ;
70
72
import edu .umd .cs .findbugs .annotations .NonNull ;
71
73
import java .util .stream .Stream ;
72
74
import org .junit .jupiter .api .BeforeAll ;
@@ -1834,6 +1836,7 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
1834
1836
.hasNonStakingChildRecordCount (0 )
1835
1837
.logged ();
1836
1838
allRunFor (spec , submitTxnRecord );
1839
+ validateTransactionFees (submitTxnRecord .getResponseRecord ());
1837
1840
}),
1838
1841
// assert topic fee collector balance
1839
1842
getAccountBalance (collector ).hasTokenBalance (tokenName , 1 ),
@@ -1843,6 +1846,14 @@ final Stream<DynamicTest> submitToTopicWith3layersFee() {
1843
1846
.hasTinyBars (ONE_HBAR )));
1844
1847
}
1845
1848
1849
+ private void validateTransactionFees (final TransactionRecord record ) {
1850
+ final var feeCreditSum = record .getTransferList ().getAccountAmountsList ().stream ()
1851
+ .filter (aa -> aa .getAccountID ().getAccountNum () < 1000 )
1852
+ .mapToInt (aa -> (int ) aa .getAmount ())
1853
+ .sum ();
1854
+ assertEquals (record .getTransactionFee (), feeCreditSum );
1855
+ }
1856
+
1846
1857
@ HapiTest
1847
1858
@ DisplayName ("Submit ot topic with multiple 3 layers fee should have 0 child records" )
1848
1859
final Stream <DynamicTest > submitToTopicWithMultiple3layersFee () {
0 commit comments