diff --git a/web/src/main/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDto.java b/web/src/main/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDto.java index 89b32d46..b6ebae24 100644 --- a/web/src/main/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDto.java +++ b/web/src/main/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDto.java @@ -25,6 +25,4 @@ public record ChannelDetailsDto( RebalanceReportDto rebalanceReport, Set warnings ) { - - } diff --git a/web/src/test/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDtoTest.java b/web/src/test/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDtoTest.java new file mode 100644 index 00000000..0e049e29 --- /dev/null +++ b/web/src/test/java/de/cotto/lndmanagej/ui/dto/ChannelDetailsDtoTest.java @@ -0,0 +1,83 @@ +package de.cotto.lndmanagej.ui.dto; + +import de.cotto.lndmanagej.controller.dto.BalanceInformationDto; +import de.cotto.lndmanagej.controller.dto.FeeReportDto; +import de.cotto.lndmanagej.controller.dto.FlowReportDto; +import de.cotto.lndmanagej.controller.dto.OnChainCostsDto; +import de.cotto.lndmanagej.controller.dto.PoliciesDto; +import de.cotto.lndmanagej.controller.dto.RebalanceReportDto; +import de.cotto.lndmanagej.model.OpenInitiator; +import org.junit.jupiter.api.Test; + +import static de.cotto.lndmanagej.controller.dto.ChannelDetailsDtoFixture.CHANNEL_DETAILS_DTO; +import static de.cotto.lndmanagej.model.BalanceInformationFixtures.BALANCE_INFORMATION; +import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID; +import static de.cotto.lndmanagej.model.FeeReportFixtures.FEE_REPORT; +import static de.cotto.lndmanagej.model.FlowReportFixtures.FLOW_REPORT; +import static de.cotto.lndmanagej.model.OnChainCostsFixtures.ON_CHAIN_COSTS; +import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL; +import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY; +import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT; +import static de.cotto.lndmanagej.model.warnings.ChannelWarningsFixtures.CHANNEL_WARNINGS; +import static org.assertj.core.api.Assertions.assertThat; + +class ChannelDetailsDtoTest { + // CPD-OFF + @Test + void channelId() { + assertThat(CHANNEL_DETAILS_DTO.channelId()).isEqualTo(CHANNEL_ID); + } + + @Test + void remotePubkey() { + assertThat(CHANNEL_DETAILS_DTO.remotePubkey()).isEqualTo(PUBKEY); + } + + @Test + void remoteAlias() { + assertThat(CHANNEL_DETAILS_DTO.remoteAlias()).isEqualTo("Albert"); + } + + @Test + void openInitiator() { + assertThat(CHANNEL_DETAILS_DTO.openInitiator()).isEqualTo(OpenInitiator.LOCAL); + } + + @Test + void balanceInformation() { + assertThat(CHANNEL_DETAILS_DTO.balanceInformation()) + .isEqualTo(BalanceInformationDto.createFromModel(BALANCE_INFORMATION)); + } + + @Test + void onChainCosts() { + assertThat(CHANNEL_DETAILS_DTO.onChainCosts()).isEqualTo(OnChainCostsDto.createFromModel(ON_CHAIN_COSTS)); + } + + @Test + void policies() { + assertThat(CHANNEL_DETAILS_DTO.policies()).isEqualTo(PoliciesDto.createFromModel(POLICIES_FOR_LOCAL_CHANNEL)); + } + + @Test + void feeReport() { + assertThat(CHANNEL_DETAILS_DTO.feeReport()).isEqualTo(FeeReportDto.createFromModel(FEE_REPORT)); + } + + @Test + void flowReport() { + assertThat(CHANNEL_DETAILS_DTO.flowReport()).isEqualTo(FlowReportDto.createFromModel(FLOW_REPORT)); + } + + @Test + void rebalanceReport() { + assertThat(CHANNEL_DETAILS_DTO.rebalanceReport()) + .isEqualTo(RebalanceReportDto.createFromModel(REBALANCE_REPORT)); + } + + @Test + void warnings() { + assertThat(CHANNEL_DETAILS_DTO.warnings()).isEqualTo(CHANNEL_WARNINGS.descriptions()); + } + // CPD-ON +}