return summed fees and amounts for self payments

This commit is contained in:
Carsten Otto
2021-12-14 23:31:16 +01:00
parent 59713d1033
commit 39a6aba404
4 changed files with 69 additions and 19 deletions

View File

@@ -0,0 +1,31 @@
package de.cotto.lndmanagej.dto;
import org.junit.jupiter.api.Test;
import java.util.List;
import static de.cotto.lndmanagej.model.SelfPaymentFixtures.SELF_PAYMENT;
import static de.cotto.lndmanagej.model.SelfPaymentFixtures.SELF_PAYMENT_2;
import static org.assertj.core.api.Assertions.assertThat;
class SelfPaymentsDtoTest {
@Test
void no_self_payments() {
SelfPaymentsDto empty = new SelfPaymentsDto(List.of());
assertThat(empty.selfPayments()).isEmpty();
}
@Test
void amountPaid() {
SelfPaymentsDto empty = new SelfPaymentsDto(List.of(SELF_PAYMENT, SELF_PAYMENT_2));
String expected = String.valueOf(SELF_PAYMENT.amountPaid().add(SELF_PAYMENT_2.amountPaid()).milliSatoshis());
assertThat(empty.amountPaid()).isEqualTo(expected);
}
@Test
void fees() {
SelfPaymentsDto empty = new SelfPaymentsDto(List.of(SELF_PAYMENT, SELF_PAYMENT_2));
String expected = String.valueOf(SELF_PAYMENT.fees().add(SELF_PAYMENT_2.fees()).milliSatoshis());
assertThat(empty.fees()).isEqualTo(expected);
}
}