mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-22 15:35:10 +01:00
persist completed payments
This commit is contained in:
@@ -46,11 +46,11 @@ class ChannelControllerTest {
|
||||
private static final Coins OPEN_COSTS = Coins.ofSatoshis(1);
|
||||
private static final Coins CLOSE_COSTS = Coins.ofSatoshis(2);
|
||||
private static final OnChainCostsDto ON_CHAIN_COSTS = new OnChainCostsDto(OPEN_COSTS, CLOSE_COSTS);
|
||||
private static final PoliciesDto FEE_CONFIGURATION_DTO = PoliciesDto.createFrom(POLICIES);
|
||||
private static final PoliciesDto FEE_CONFIGURATION_DTO = PoliciesDto.createFromModel(POLICIES);
|
||||
private static final ClosedChannelDetailsDto CLOSED_CHANNEL_DETAILS_DTO =
|
||||
new ClosedChannelDetailsDto(CloseInitiator.REMOTE, 987_654);
|
||||
private static final FeeReport FEE_REPORT = new FeeReport(Coins.ofMilliSatoshis(1_234), Coins.ofMilliSatoshis(567));
|
||||
private static final FeeReportDto FEE_REPORT_DTO = FeeReportDto.createFrom(FEE_REPORT);
|
||||
private static final FeeReportDto FEE_REPORT_DTO = FeeReportDto.createFromModel(FEE_REPORT);
|
||||
|
||||
@InjectMocks
|
||||
private ChannelController channelController;
|
||||
@@ -165,14 +165,14 @@ class ChannelControllerTest {
|
||||
void getBalance() {
|
||||
when(balanceService.getBalanceInformation(CHANNEL_ID)).thenReturn(Optional.of(BALANCE_INFORMATION));
|
||||
assertThat(channelController.getBalance(CHANNEL_ID))
|
||||
.isEqualTo(BalanceInformationDto.createFrom(BALANCE_INFORMATION));
|
||||
.isEqualTo(BalanceInformationDto.createFromModel(BALANCE_INFORMATION));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBalance_not_found() {
|
||||
when(balanceService.getBalanceInformation(CHANNEL_ID)).thenReturn(Optional.empty());
|
||||
assertThat(channelController.getBalance(CHANNEL_ID))
|
||||
.isEqualTo(BalanceInformationDto.createFrom(BalanceInformation.EMPTY));
|
||||
.isEqualTo(BalanceInformationDto.createFromModel(BalanceInformation.EMPTY));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -88,7 +88,7 @@ class NodeControllerTest {
|
||||
List.of(),
|
||||
List.of(),
|
||||
new OnChainCostsDto(Coins.NONE, Coins.NONE),
|
||||
BalanceInformationDto.createFrom(BalanceInformation.EMPTY),
|
||||
BalanceInformationDto.createFromModel(BalanceInformation.EMPTY),
|
||||
true,
|
||||
new FeeReportDto("0", "0")
|
||||
);
|
||||
@@ -122,7 +122,7 @@ class NodeControllerTest {
|
||||
List.of(CHANNEL_ID, CHANNEL_ID_2),
|
||||
List.of(CHANNEL_ID, CHANNEL_ID_2, CHANNEL_ID_3),
|
||||
new OnChainCostsDto(openCosts, closeCosts),
|
||||
BalanceInformationDto.createFrom(BALANCE_INFORMATION),
|
||||
BalanceInformationDto.createFromModel(BALANCE_INFORMATION),
|
||||
false,
|
||||
new FeeReportDto("1234", "567")
|
||||
);
|
||||
@@ -161,7 +161,8 @@ class NodeControllerTest {
|
||||
@Test
|
||||
void getBalance() {
|
||||
when(balanceService.getBalanceInformationForPeer(PUBKEY)).thenReturn(BALANCE_INFORMATION);
|
||||
assertThat(nodeController.getBalance(PUBKEY)).isEqualTo(BalanceInformationDto.createFrom(BALANCE_INFORMATION));
|
||||
assertThat(nodeController.getBalance(PUBKEY))
|
||||
.isEqualTo(BalanceInformationDto.createFromModel(BALANCE_INFORMATION));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -7,7 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class BalanceInformationDtoTest {
|
||||
@Test
|
||||
void createFrom() {
|
||||
void createFromModel() {
|
||||
BalanceInformationDto expected = new BalanceInformationDto(
|
||||
String.valueOf(BALANCE_INFORMATION.localBalance().satoshis()),
|
||||
String.valueOf(BALANCE_INFORMATION.localReserve().satoshis()),
|
||||
@@ -16,6 +16,6 @@ class BalanceInformationDtoTest {
|
||||
String.valueOf(BALANCE_INFORMATION.remoteReserve().satoshis()),
|
||||
String.valueOf(BALANCE_INFORMATION.remoteAvailable().satoshis())
|
||||
);
|
||||
assertThat(BalanceInformationDto.createFrom(BALANCE_INFORMATION)).isEqualTo(expected);
|
||||
assertThat(BalanceInformationDto.createFromModel(BALANCE_INFORMATION)).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class ChannelDetailsDtoTest {
|
||||
FEE_REPORT
|
||||
);
|
||||
ChannelStatusDto channelStatusDto =
|
||||
ChannelStatusDto.createFrom(new ChannelStatus(false, true, false, OPEN));
|
||||
ChannelStatusDto.createFromModel(new ChannelStatus(false, true, false, OPEN));
|
||||
assertThat(dto.status()).isEqualTo(channelStatusDto);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class ChannelDetailsDtoTest {
|
||||
|
||||
@Test
|
||||
void balance() {
|
||||
assertThat(CHANNEL_DETAILS_DTO.balance()).isEqualTo(BalanceInformationDto.createFrom(BALANCE_INFORMATION));
|
||||
assertThat(CHANNEL_DETAILS_DTO.balance()).isEqualTo(BalanceInformationDto.createFromModel(BALANCE_INFORMATION));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -80,7 +80,7 @@ class ChannelDtoTest {
|
||||
void status() {
|
||||
ChannelDto dto = new ChannelDto(LOCAL_OPEN_CHANNEL, CLOSE_DETAILS);
|
||||
ChannelStatusDto channelStatusDto =
|
||||
ChannelStatusDto.createFrom(new ChannelStatus(false, true, false, OPEN));
|
||||
ChannelStatusDto.createFromModel(new ChannelStatus(false, true, false, OPEN));
|
||||
assertThat(dto.status()).isEqualTo(channelStatusDto);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class ChannelStatusDtoTest {
|
||||
private final ChannelStatus channelStatusOpen = new ChannelStatus(false, true, false, OPEN);
|
||||
|
||||
@Test
|
||||
void createFrom() {
|
||||
assertThat(ChannelStatusDto.createFrom(channelStatusOpen)).isEqualTo(dtoOpen);
|
||||
void createFromModel() {
|
||||
assertThat(ChannelStatusDto.createFromModel(channelStatusOpen)).isEqualTo(dtoOpen);
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,8 @@ class FeeReportDtoTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void createFrom() {
|
||||
assertThat(FeeReportDto.createFrom(new FeeReport(Coins.ofSatoshis(1), Coins.ofSatoshis(2))))
|
||||
void createFromModel() {
|
||||
assertThat(FeeReportDto.createFromModel(new FeeReport(Coins.ofSatoshis(1), Coins.ofSatoshis(2))))
|
||||
.isEqualTo(new FeeReportDto("1000", "2000"));
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class PoliciesDtoTest {
|
||||
@Test
|
||||
void createFrom() {
|
||||
PoliciesDto expected = new PoliciesDto(PolicyDto.createFrom(POLICY_1), PolicyDto.createFrom(POLICY_2));
|
||||
|
||||
PoliciesDto dto = PoliciesDto.createFrom(POLICIES);
|
||||
|
||||
void createFromModel() {
|
||||
PoliciesDto expected =
|
||||
new PoliciesDto(PolicyDto.createFromModel(POLICY_1), PolicyDto.createFromModel(POLICY_2));
|
||||
PoliciesDto dto = PoliciesDto.createFromModel(POLICIES);
|
||||
assertThat(dto).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class PolicyDtoTest {
|
||||
@Test
|
||||
void createFrom() {
|
||||
void createFromModel() {
|
||||
PolicyDto expected = new PolicyDto(100, 10, false);
|
||||
PolicyDto dto = PolicyDto.createFrom(POLICY_1);
|
||||
PolicyDto dto = PolicyDto.createFromModel(POLICY_1);
|
||||
assertThat(dto).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user