mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-31 03:34:36 +01:00
add incoming-base-fee and outgoing-base-fee endpoints
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.cotto.lndmanagej.controller;
|
||||
|
||||
import de.cotto.lndmanagej.model.ChannelFixtures;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import de.cotto.lndmanagej.model.LocalChannel;
|
||||
import de.cotto.lndmanagej.service.ChannelService;
|
||||
import de.cotto.lndmanagej.service.FeeService;
|
||||
@@ -109,4 +110,16 @@ class LegacyControllerTest {
|
||||
when(feeService.getOutgoingFeeRate(CHANNEL_ID)).thenReturn(123L);
|
||||
assertThat(legacyController.getOutgoingFeeRate(CHANNEL_ID)).isEqualTo(123);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingBaseFee() {
|
||||
when(feeService.getIncomingBaseFee(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(10L));
|
||||
assertThat(legacyController.getIncomingBaseFee(CHANNEL_ID)).isEqualTo(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOutgoingBaseFee() {
|
||||
when(feeService.getOutgoingBaseFee(CHANNEL_ID)).thenReturn(Coins.ofMilliSatoshis(10L));
|
||||
assertThat(legacyController.getOutgoingBaseFee(CHANNEL_ID)).isEqualTo(10);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package de.cotto.lndmanagej.service;
|
||||
|
||||
import de.cotto.lndmanagej.grpc.GrpcFees;
|
||||
import de.cotto.lndmanagej.model.Coins;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
@@ -45,4 +46,28 @@ class FeeServiceTest {
|
||||
when(grpcFees.getOutgoingFeeRate(CHANNEL_ID)).thenReturn(Optional.empty());
|
||||
assertThatIllegalStateException().isThrownBy(() -> feeService.getOutgoingFeeRate(CHANNEL_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingBaseFee() {
|
||||
when(grpcFees.getIncomingBaseFee(CHANNEL_ID)).thenReturn(Optional.of(Coins.ofMilliSatoshis(123L)));
|
||||
assertThat(feeService.getIncomingBaseFee(CHANNEL_ID)).isEqualTo(Coins.ofMilliSatoshis(123L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getIncomingBaseFee_empty() {
|
||||
when(grpcFees.getIncomingBaseFee(CHANNEL_ID)).thenReturn(Optional.empty());
|
||||
assertThatIllegalStateException().isThrownBy(() -> feeService.getIncomingBaseFee(CHANNEL_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOutgoingBaseFee() {
|
||||
when(grpcFees.getOutgoingBaseFee(CHANNEL_ID)).thenReturn(Optional.of(Coins.ofMilliSatoshis(123L)));
|
||||
assertThat(feeService.getOutgoingBaseFee(CHANNEL_ID)).isEqualTo(Coins.ofMilliSatoshis(123L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOutgoingBaseFee_empty() {
|
||||
when(grpcFees.getOutgoingBaseFee(CHANNEL_ID)).thenReturn(Optional.empty());
|
||||
assertThatIllegalStateException().isThrownBy(() -> feeService.getOutgoingBaseFee(CHANNEL_ID));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user