mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-21 15:04:22 +01:00
rename "policies" to "policies for local channel"
This commit is contained in:
@@ -9,7 +9,7 @@ import de.cotto.lndmanagej.controller.dto.PoliciesDto;
|
||||
import de.cotto.lndmanagej.model.BalanceInformation;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.FeeReport;
|
||||
import de.cotto.lndmanagej.model.Policies;
|
||||
import de.cotto.lndmanagej.model.PoliciesForLocalChannel;
|
||||
import de.cotto.lndmanagej.service.BalanceService;
|
||||
import de.cotto.lndmanagej.service.ChannelDetailsService;
|
||||
import de.cotto.lndmanagej.service.ChannelService;
|
||||
@@ -28,7 +28,7 @@ import static de.cotto.lndmanagej.model.ChannelDetailsFixtures.CHANNEL_DETAILS;
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
|
||||
import static de.cotto.lndmanagej.model.CoopClosedChannelFixtures.CLOSED_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.WaitingCloseChannelFixtures.WAITING_CLOSE_CHANNEL;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
@@ -36,7 +36,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ChannelControllerTest {
|
||||
private static final PoliciesDto POLICIES_DTO = PoliciesDto.createFromModel(POLICIES);
|
||||
private static final PoliciesDto POLICIES_DTO = PoliciesDto.createFromModel(POLICIES_FOR_LOCAL_CHANNEL);
|
||||
private static final ClosedChannelDetailsDto CLOSED_CHANNEL_DETAILS_DTO =
|
||||
ClosedChannelDetailsDto.createFromModel(CLOSED_CHANNEL);
|
||||
private static final FeeReport FEE_REPORT = new FeeReport(Coins.ofMilliSatoshis(1_234), Coins.ofMilliSatoshis(567));
|
||||
@@ -111,19 +111,21 @@ class ChannelControllerTest {
|
||||
@Test
|
||||
void getPolicies() {
|
||||
when(channelService.getLocalChannel(CHANNEL_ID)).thenReturn(Optional.of(LOCAL_OPEN_CHANNEL));
|
||||
when(policyService.getPolicies(CHANNEL_ID)).thenReturn(POLICIES);
|
||||
when(policyService.getPolicies(LOCAL_OPEN_CHANNEL)).thenReturn(POLICIES_FOR_LOCAL_CHANNEL);
|
||||
assertThat(channelController.getPolicies(CHANNEL_ID)).isEqualTo(POLICIES_DTO);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getPolicies_waiting_close() {
|
||||
when(channelService.getLocalChannel(CHANNEL_ID)).thenReturn(Optional.of(WAITING_CLOSE_CHANNEL));
|
||||
assertThat(channelController.getPolicies(CHANNEL_ID)).isEqualTo(PoliciesDto.createFromModel(Policies.UNKNOWN));
|
||||
assertThat(channelController.getPolicies(CHANNEL_ID))
|
||||
.isEqualTo(PoliciesDto.createFromModel(PoliciesForLocalChannel.UNKNOWN));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getPolicies_channel_not_found() {
|
||||
assertThat(channelController.getPolicies(CHANNEL_ID)).isEqualTo(PoliciesDto.createFromModel(Policies.UNKNOWN));
|
||||
assertThat(channelController.getPolicies(CHANNEL_ID))
|
||||
.isEqualTo(PoliciesDto.createFromModel(PoliciesForLocalChannel.UNKNOWN));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,4 +145,4 @@ class ChannelControllerTest {
|
||||
when(feeService.getFeeReportForChannel(CHANNEL_ID)).thenReturn(FEE_REPORT);
|
||||
assertThat(channelController.getFeeReport(CHANNEL_ID)).isEqualTo(FeeReportDto.createFromModel(FEE_REPORT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import de.cotto.lndmanagej.model.ChannelStatus;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.FeeReport;
|
||||
import de.cotto.lndmanagej.model.OpenInitiator;
|
||||
import de.cotto.lndmanagej.model.Policies;
|
||||
import de.cotto.lndmanagej.model.PoliciesForLocalChannel;
|
||||
import de.cotto.lndmanagej.model.RebalanceReport;
|
||||
import de.cotto.lndmanagej.model.warnings.ChannelWarnings;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -21,7 +21,7 @@ import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHAN
|
||||
import static de.cotto.lndmanagej.model.NodeFixtures.ALIAS;
|
||||
import static de.cotto.lndmanagej.model.OnChainCostsFixtures.ON_CHAIN_COSTS;
|
||||
import static de.cotto.lndmanagej.model.OpenCloseStatus.OPEN;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
|
||||
import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT;
|
||||
import static de.cotto.lndmanagej.model.warnings.ChannelWarningsFixtures.CHANNEL_WARNINGS;
|
||||
@@ -38,7 +38,7 @@ class ChannelDetailsDtoTest {
|
||||
ALIAS,
|
||||
BALANCE_INFORMATION,
|
||||
ON_CHAIN_COSTS,
|
||||
Policies.UNKNOWN,
|
||||
PoliciesForLocalChannel.UNKNOWN,
|
||||
FEE_REPORT,
|
||||
FLOW_REPORT,
|
||||
REBALANCE_REPORT,
|
||||
@@ -52,7 +52,7 @@ class ChannelDetailsDtoTest {
|
||||
ALIAS,
|
||||
BALANCE_INFORMATION,
|
||||
ON_CHAIN_COSTS,
|
||||
POLICIES,
|
||||
POLICIES_FOR_LOCAL_CHANNEL,
|
||||
FEE_REPORT,
|
||||
FLOW_REPORT,
|
||||
REBALANCE_REPORT,
|
||||
@@ -113,7 +113,7 @@ class ChannelDetailsDtoTest {
|
||||
ALIAS,
|
||||
BALANCE_INFORMATION,
|
||||
ON_CHAIN_COSTS,
|
||||
Policies.UNKNOWN,
|
||||
PoliciesForLocalChannel.UNKNOWN,
|
||||
FEE_REPORT,
|
||||
FLOW_REPORT,
|
||||
RebalanceReport.EMPTY,
|
||||
@@ -155,4 +155,4 @@ class ChannelDetailsDtoTest {
|
||||
.isEqualTo(RebalanceReportDto.createFromModel(REBALANCE_REPORT));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@ package de.cotto.lndmanagej.controller.dto;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICY_1;
|
||||
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICY_2;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class PoliciesDtoTest {
|
||||
class PoliciesForLocalChannelDtoTest {
|
||||
@Test
|
||||
void createFromModel() {
|
||||
PoliciesDto expected =
|
||||
new PoliciesDto(PolicyDto.createFromModel(POLICY_1), PolicyDto.createFromModel(POLICY_2));
|
||||
PoliciesDto dto = PoliciesDto.createFromModel(POLICIES);
|
||||
PoliciesDto dto = PoliciesDto.createFromModel(POLICIES_FOR_LOCAL_CHANNEL);
|
||||
assertThat(dto).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user