minor fixes, preparation for PMD 7

This commit is contained in:
Carsten Otto
2024-04-11 12:46:40 +02:00
parent 099270c622
commit 3cece1612f
50 changed files with 80 additions and 74 deletions

View File

@@ -71,7 +71,7 @@ class ArchUnitIT {
rule.check(importedClasses);
}
private static class DoNotIncludeTestClasses implements ImportOption {
private static final class DoNotIncludeTestClasses implements ImportOption {
private static final Pattern GRADLE_PATTERN = Pattern.compile(".*/build/classes/([^/]+/)?[a-zA-Z-]*[tT]est/.*");
@Override

View File

@@ -13,9 +13,9 @@ import org.springframework.stereotype.Component;
import java.util.Optional;
import java.util.stream.Stream;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_LOWER_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_UPPER_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL;
@Component
public class ChannelBalanceFluctuationWarningsProvider implements ChannelWarningsProvider {
@@ -78,7 +78,7 @@ public class ChannelBalanceFluctuationWarningsProvider implements ChannelWarning
private boolean ignoreWarning(ChannelId channelId) {
return configurationService.getChannelIds(
CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL,
CHANNEL_FLUCTUATION_IGNORE_CHANNEL,
channelIdParser::parseFromString
).contains(channelId);
}

View File

@@ -16,9 +16,9 @@ import javax.annotation.Nullable;
import java.util.Optional;
import java.util.Set;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_LOWER_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_UPPER_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID_2;
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID_3;
@@ -132,14 +132,14 @@ class ChannelBalanceFluctuationWarningsProviderTest {
@Test
void no_warning_for_ignored_channel() {
when(configurationService.getChannelIds(eq(CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL), any()))
when(configurationService.getChannelIds(eq(CHANNEL_FLUCTUATION_IGNORE_CHANNEL), any()))
.thenReturn(Set.of(CHANNEL_ID_3, CHANNEL_ID));
assertThat(warningsProvider.getChannelWarnings(CHANNEL_ID)).isEmpty();
}
@Test
void warning_if_other_channel_is_ignored() {
when(configurationService.getChannelIds(eq(CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL), any()))
when(configurationService.getChannelIds(eq(CHANNEL_FLUCTUATION_IGNORE_CHANNEL), any()))
.thenReturn(Set.of(CHANNEL_ID_2, CHANNEL_ID_3));
assertThat(warningsProvider.getChannelWarnings(CHANNEL_ID)).isNotEmpty();
}

View File

@@ -46,7 +46,7 @@ class CacheBuilderTest {
.build(() -> {
try {
Thread.sleep(20);
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
// ignored
}
return System.nanoTime();
@@ -68,7 +68,7 @@ class CacheBuilderTest {
.build(() -> {
try {
Thread.sleep(1_000);
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
// ignore
}
return System.nanoTime();
@@ -108,7 +108,7 @@ class CacheBuilderTest {
.withMaximumSize(1)
.build(System::nanoTime);
Long first = cache.get("");
@SuppressWarnings("unused") var unused = cache.get("a");
@SuppressWarnings("unused") Long unused = cache.get("a");
cache.cleanUp();
Long third = cache.get("");
assertThat(first).isNotEqualTo(third);

View File

@@ -40,7 +40,7 @@ public class IniFileReader {
}
private Map<String, Set<String>> toMultiValueMap(Profile.Section section) {
LinkedHashMap<String, Set<String>> result = new LinkedHashMap<>();
Map<String, Set<String>> result = new LinkedHashMap<>();
for (String key : section.keySet()) {
result.put(key, new HashSet<>(section.getAll(key)));
}

View File

@@ -7,7 +7,7 @@ public enum WarningsConfigurationSettings implements ConfigurationSetting {
CHANNEL_FLUCTUATION_LOWER_THRESHOLD("channel_fluctuation_lower_threshold"),
CHANNEL_FLUCTUATION_UPPER_THRESHOLD("channel_fluctuation_upper_threshold"),
CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL("channel_fluctuation_warning_ignore_channel"),
CHANNEL_FLUCTUATION_IGNORE_CHANNEL("channel_fluctuation_warning_ignore_channel"),
NODE_FLOW_MAXIMUM_DAYS_TO_CONSIDER("node_flow_maximum_days_to_consider"),
NODE_FLOW_MINIMUM_DAYS_FOR_WARNING("node_flow_minimum_days_for_warning"),

View File

@@ -13,7 +13,7 @@ import java.util.Map;
import java.util.Set;
import static de.cotto.lndmanagej.configuration.PickhardtPaymentsConfigurationSettings.USE_MISSION_CONTROL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.ONLINE_CHANGES_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.ONLINE_WARNING_IGNORE_NODE;
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
@@ -132,7 +132,7 @@ class ConfigurationServiceTest {
@Test
void getChannelIds_not_known_empty() {
Set<ChannelId> channelIds = configurationService.getChannelIds(
CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL, channelIdParser::parseFromString
CHANNEL_FLUCTUATION_IGNORE_CHANNEL, channelIdParser::parseFromString
);
assertThat(channelIds).isEmpty();
}
@@ -144,7 +144,7 @@ class ConfigurationServiceTest {
when(channelIdParser.parseFromString(String.valueOf(CHANNEL_ID_3.getShortChannelId())))
.thenReturn(CHANNEL_ID_3);
when(channelIdParser.parseFromString(CHANNEL_POINT.toString())).thenReturn(CHANNEL_ID_4);
WarningsConfigurationSettings config = CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL;
WarningsConfigurationSettings config = CHANNEL_FLUCTUATION_IGNORE_CHANNEL;
when(iniFileReader.getValues(config.getSection()))
.thenReturn(Map.of(config.getName(),
Set.of(
@@ -160,7 +160,7 @@ class ConfigurationServiceTest {
@Test()
void getChannelIds_forInvalidWarningConfig_error() {
when(channelIdParser.parseFromString("invalid_chan")).thenThrow(new IllegalArgumentException());
WarningsConfigurationSettings config = CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL;
WarningsConfigurationSettings config = CHANNEL_FLUCTUATION_IGNORE_CHANNEL;
when(iniFileReader.getValues(config.getSection())).thenReturn(Map.of(config.getName(), Set.of("invalid_chan")));
assertThatIllegalArgumentException().isThrownBy(
() -> configurationService.getChannelIds(config, channelIdParser::parseFromString)

View File

@@ -2,9 +2,9 @@ package de.cotto.lndmanagej.configuration;
import org.junit.jupiter.api.Test;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_LOWER_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_UPPER_THRESHOLD;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.NODE_FLOW_MAXIMUM_DAYS_TO_CONSIDER;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.NODE_FLOW_MINIMUM_DAYS_FOR_WARNING;
import static de.cotto.lndmanagej.configuration.WarningsConfigurationSettings.NODE_FLOW_WARNING_IGNORE_NODE;
@@ -32,8 +32,8 @@ class WarningsConfigurationSettingsTest {
@Test
void channelFluctuationIgnoreWarning() {
assertThat(CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL.getSection()).isEqualTo(SECTION_NAME);
assertThat(CHANNEL_FLUCTUATION_WARNING_IGNORE_CHANNEL.getName())
assertThat(CHANNEL_FLUCTUATION_IGNORE_CHANNEL.getSection()).isEqualTo(SECTION_NAME);
assertThat(CHANNEL_FLUCTUATION_IGNORE_CHANNEL.getName())
.isEqualTo("channel_fluctuation_warning_ignore_channel");
}

View File

@@ -57,7 +57,7 @@ public class GrpcMiddlewareService implements ObserverIsDoneListener {
private void sleep() {
try {
Thread.sleep(10_000);
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
// ignore
}
}

View File

@@ -121,7 +121,7 @@ class GrpcInvoicesTest {
@Test
void with_keysend_message_just_preimage() {
LinkedHashMap<Long, ByteString> customRecords = new LinkedHashMap<>();
Map<Long, ByteString> customRecords = new LinkedHashMap<>();
customRecords.put(5_482_373_484L, ByteString.copyFromUtf8("000"));
mockResponse(invoice(SETTLED, SETTLED_INVOICE_KEYSEND, customRecords, List.of()));
assertThat(grpcInvoices.getSettledInvoicesAfter(0L)).contains(
@@ -131,7 +131,7 @@ class GrpcInvoicesTest {
@Test
void with_keysend_message_without_preimage() {
LinkedHashMap<Long, ByteString> customRecords = new LinkedHashMap<>();
Map<Long, ByteString> customRecords = new LinkedHashMap<>();
customRecords.put(7_629_168L, ByteString.copyFromUtf8(KEYSEND_MESSAGE));
mockResponse(invoice(SETTLED, SETTLED_INVOICE_KEYSEND, customRecords, List.of()));
assertThat(grpcInvoices.getSettledInvoicesAfter(0L)).contains(
@@ -311,14 +311,14 @@ class GrpcInvoicesTest {
}
private Invoice keysendInvoice() {
LinkedHashMap<Long, ByteString> customRecords = new LinkedHashMap<>();
Map<Long, ByteString> customRecords = new LinkedHashMap<>();
customRecords.put(5_482_373_484L, ByteString.copyFromUtf8("000"));
customRecords.put(7_629_168L, ByteString.copyFromUtf8(KEYSEND_MESSAGE));
return invoice(SETTLED, SETTLED_INVOICE_KEYSEND, customRecords, List.of());
}
private Invoice keysendInvoiceV2() {
LinkedHashMap<Long, ByteString> customRecords = new LinkedHashMap<>();
Map<Long, ByteString> customRecords = new LinkedHashMap<>();
customRecords.put(5_482_373_484L, ByteString.copyFromUtf8("000"));
customRecords.put(34_349_334L, ByteString.copyFromUtf8(KEYSEND_MESSAGE));
return invoice(SETTLED, SETTLED_INVOICE_KEYSEND, customRecords, List.of());

View File

@@ -49,7 +49,7 @@ class ReportingStreamObserverTest {
assertThat(sendToRouteObserver.seenFailureCode).isEqualTo(FINAL_INCORRECT_HTLC_AMOUNT);
}
private static class TestableSendToRouteObserver implements SendToRouteObserver {
private static final class TestableSendToRouteObserver implements SendToRouteObserver {
@Nullable
private Throwable seenThrowable;

View File

@@ -33,18 +33,18 @@ public record Coins(long milliSatoshis) implements Comparable<Coins> {
if (this.milliSatoshis == 0) {
return summand;
}
return Coins.ofMilliSatoshis(milliSatoshis + summand.milliSatoshis);
return ofMilliSatoshis(milliSatoshis + summand.milliSatoshis);
}
public Coins subtract(Coins subtrahend) {
if (subtrahend.milliSatoshis == 0) {
return this;
}
return Coins.ofMilliSatoshis(milliSatoshis - subtrahend.milliSatoshis);
return ofMilliSatoshis(milliSatoshis - subtrahend.milliSatoshis);
}
public Coins absolute() {
return Coins.ofMilliSatoshis(Math.abs(milliSatoshis));
return ofMilliSatoshis(Math.abs(milliSatoshis));
}
@Override
@@ -67,7 +67,7 @@ public record Coins(long milliSatoshis) implements Comparable<Coins> {
}
public Coins negate() {
return Coins.ofMilliSatoshis(-milliSatoshis);
return ofMilliSatoshis(-milliSatoshis);
}
public boolean isPositive() {

View File

@@ -27,7 +27,7 @@ public record Node(
}
public static Node forPubkey(Pubkey pubkey) {
return Node.builder().withPubkey(pubkey).build();
return builder().withPubkey(pubkey).build();
}
@Override

View File

@@ -12,6 +12,7 @@ public record Resolution(Optional<TransactionHash> sweepTransaction, String reso
private static final String ANCHOR = "ANCHOR";
private static final String COMMIT = "COMMIT";
@SuppressWarnings("PMD.SimplifyBooleanReturns")
public boolean sweepTransactionClaimsFunds() {
if (OUTGOING_HTLC.equals(resolutionType) && TIMEOUT.equals(outcome)) {
return true;

View File

@@ -60,7 +60,7 @@ public class Route {
if (amountSat > upperBoundSat) {
return 0.0;
}
return (1.0 * (upperBoundSat + 1 - amountSat)) / (upperBoundSat + 1 - lowerBoundSat);
return 1.0 * (upperBoundSat + 1 - amountSat) / (upperBoundSat + 1 - lowerBoundSat);
}
public Coins getFees() {

View File

@@ -108,6 +108,7 @@ class PaymentsDaoImplTest {
}
@Test
@SuppressWarnings("PMD.CompareObjectsWithEquals")
void uses_existing_instance_for_update() {
SettledPaymentIndexJpaDto existingInstance = new SettledPaymentIndexJpaDto();
existingInstance.setAllSettledIndexOffset(23);

View File

@@ -70,7 +70,7 @@ class MultiPathPaymentObserverIT {
private void unlockAfterSomeMilliSeconds(SendToRouteObserver sendToRouteObserver) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
// ignore
}
sendToRouteObserver.onError(new NullPointerException());

View File

@@ -106,6 +106,7 @@ public class EdgeComputation {
return EdgeWithLiquidityInformation.forLowerAndUpperBound(edge, lowerBound, upperBound);
}
@SuppressWarnings("PMD.SimplifyBooleanReturns")
private boolean shouldIgnore(
DirectedChannelEdge channelEdge,
PaymentOptions paymentOptions,
@@ -140,6 +141,7 @@ public class EdgeComputation {
return feeRate >= feeRateLimitFirstHops;
}
@SuppressWarnings("PMD.SimplifyBooleanReturns")
private boolean isEdgeToUnwantedFirstHop(
DirectedChannelEdge channelEdge,
PaymentOptions paymentOptions,

View File

@@ -138,7 +138,7 @@ public class MultiPathPaymentSplitter {
Coins capacity = localChannel.getCapacity();
Edge extensionEdge = new Edge(channelId, peer, originalTarget, capacity, policy);
return basicRoutes.stream().map(basicRoute -> {
ArrayList<Edge> edges = new ArrayList<>(basicRoute.edges());
List<Edge> edges = new ArrayList<>(basicRoute.edges());
edges.add(extensionEdge);
return new BasicRoute(edges, basicRoute.amount());
}).toList();

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public class TestObjectMapper extends ObjectMapper {
@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
public TestObjectMapper() {
super();
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

View File

@@ -18,7 +18,7 @@ import java.util.List;
import static de.cotto.lndmanagej.ui.controller.param.SortBy.SORT_PARAM_KEY;
import static de.cotto.lndmanagej.ui.dto.NodeDtoFixture.NODE_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

View File

@@ -27,8 +27,8 @@ import static de.cotto.lndmanagej.model.ChannelPointFixtures.CHANNEL_POINT;
import static de.cotto.lndmanagej.ui.controller.param.SortBy.DEFAULT_SORT;
import static de.cotto.lndmanagej.ui.dto.ChannelDetailsDtoFixture.CHANNEL_DETAILS_DTO;
import static de.cotto.lndmanagej.ui.dto.NodeDetailsDtoFixture.NODE_DETAILS_MODEL;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO2;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO2;
import static org.hamcrest.core.Is.is;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;

View File

@@ -31,7 +31,7 @@ public record BalanceInformationModel(
public double getOutboundPercentage() {
long outbound = localBalanceSat();
long routableCapacity = outbound + remoteBalanceSat();
return (1.0 * outbound / routableCapacity) * 100;
return 1.0 * outbound / routableCapacity * 100;
}
public long getRoutableCapacity() {

View File

@@ -42,7 +42,7 @@ public class StatusInterceptor implements HandlerInterceptor {
}
boolean isStatusPage(@Nullable String path) {
return path != null && path.equals("/status");
return "/status".equals(path);
}
boolean isResource(@Nullable String path) {

View File

@@ -3,7 +3,7 @@ package de.cotto.lndmanagej.ui.page.channel;
import de.cotto.lndmanagej.ui.dto.ChannelDetailsDto;
import de.cotto.lndmanagej.ui.page.general.ThymeleafPage;
public class ChannelDetailsPage extends ThymeleafPage {
public final class ChannelDetailsPage extends ThymeleafPage {
public ChannelDetailsPage(ChannelDetailsDto channel) {
super();

View File

@@ -5,7 +5,7 @@ import de.cotto.lndmanagej.ui.page.general.ThymeleafPage;
import java.util.List;
public class ChannelsPage extends ThymeleafPage {
public final class ChannelsPage extends ThymeleafPage {
public ChannelsPage(List<OpenChannelDto> channels) {
super();

View File

@@ -5,7 +5,7 @@ import de.cotto.lndmanagej.ui.page.general.ThymeleafPage;
import java.util.List;
public class PendingChannelsPage extends ThymeleafPage {
public final class PendingChannelsPage extends ThymeleafPage {
public PendingChannelsPage(List<PendingOpenChannelDto> pendingOpenChannels) {
super();

View File

@@ -6,7 +6,7 @@ import de.cotto.lndmanagej.ui.dto.warning.DashboardWarningDto;
import java.util.List;
public class DashboardPage extends ThymeleafPage {
public final class DashboardPage extends ThymeleafPage {
private final List<NodeDto> nodes;
private final List<OpenChannelDto> channels;

View File

@@ -1,6 +1,6 @@
package de.cotto.lndmanagej.ui.page.general;
public class ErrorPage extends ThymeleafPage {
public final class ErrorPage extends ThymeleafPage {
public ErrorPage(String message) {
super();

View File

@@ -3,7 +3,7 @@ package de.cotto.lndmanagej.ui.page.node;
import de.cotto.lndmanagej.ui.dto.NodeDetailsDto;
import de.cotto.lndmanagej.ui.page.general.ThymeleafPage;
public class NodeDetailsPage extends ThymeleafPage {
public final class NodeDetailsPage extends ThymeleafPage {
public NodeDetailsPage(NodeDetailsDto nodeDetails) {
super();
add("pubkey", nodeDetails.node());

View File

@@ -5,7 +5,7 @@ import de.cotto.lndmanagej.ui.page.general.ThymeleafPage;
import java.util.List;
public class NodesPage extends ThymeleafPage {
public final class NodesPage extends ThymeleafPage {
private final List<NodeDto> nodes;

View File

@@ -53,9 +53,9 @@ import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_3;
import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT;
import static de.cotto.lndmanagej.model.warnings.ChannelWarningFixtures.CHANNEL_BALANCE_FLUCTUATION_WARNING;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.NodeDetailsDtoFixture.NODE_DETAILS_MODEL;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.CAPACITY_SAT;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.CAPACITY_SAT;
import static de.cotto.lndmanagej.ui.dto.PendingOpenChannelDtoFixture.PENDING_OPEN_CHANNEL_DTO;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

View File

@@ -16,7 +16,7 @@ import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
import static de.cotto.lndmanagej.ui.dto.ChannelDetailsDtoFixture.CHANNEL_DETAILS_DTO;
import static de.cotto.lndmanagej.ui.dto.NodeDetailsDtoFixture.NODE_DETAILS_MODEL;
import static de.cotto.lndmanagej.ui.dto.NodeDtoFixture.NODE_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.PendingOpenChannelDtoFixture.PENDING_OPEN_CHANNEL_DTO;
import static org.assertj.core.api.Assertions.assertThat;
@@ -43,7 +43,7 @@ class UiDataServiceTest {
assertThat(uiDataService.calculateDaysOfBlocks(123_456, 123_311)).isEqualTo(2);
}
private static class TestableUiDataService extends UiDataService {
private static final class TestableUiDataService extends UiDataService {
@Override
public Set<Pubkey> getPubkeys() {

View File

@@ -20,7 +20,7 @@ import static de.cotto.lndmanagej.model.NodeFixtures.NODE_PEER;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
import static de.cotto.lndmanagej.ui.controller.param.SortBy.DEFAULT_SORT;
import static de.cotto.lndmanagej.ui.controller.param.SortBy.RATIO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;

View File

@@ -23,7 +23,7 @@ import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
import static de.cotto.lndmanagej.ui.dto.ChannelDetailsDtoFixture.CHANNEL_DETAILS_DTO;
import static de.cotto.lndmanagej.ui.dto.NodeDtoFixture.NODE_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;

View File

@@ -4,9 +4,9 @@ import de.cotto.lndmanagej.model.BalanceInformation;
import de.cotto.lndmanagej.model.Coins;
import org.junit.jupiter.api.Test;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.LOW_LOCAL_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.LOW_REMOTE_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.LOW_LOCAL_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.LOW_REMOTE_MODEL;
import static org.assertj.core.api.Assertions.assertThat;
class BalanceInformationModelTest {

View File

@@ -23,7 +23,7 @@ import static de.cotto.lndmanagej.model.PeerRatingFixtures.PEER_RATING;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT;
import static de.cotto.lndmanagej.model.warnings.NodeWarningsFixtures.NODE_WARNINGS;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL_2;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL_2;
import static de.cotto.lndmanagej.ui.dto.ClosedChannelDtoFixture.CLOSED_CHANNEL_DTO;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -7,7 +7,7 @@ import static de.cotto.lndmanagej.model.BalanceInformationFixtures.BALANCE_INFOR
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNEL;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static org.assertj.core.api.Assertions.assertThat;
class OpenChannelDtoTest {

View File

@@ -38,7 +38,7 @@ class DashboardWarningDtoTest {
@Test
void node_without_alias_is_shown_with_pubkey() {
var nodeWithoutAlias = new DashboardWarningDto(
DashboardWarningDto nodeWithoutAlias = new DashboardWarningDto(
"",
PUBKEY,
Set.of("This is a node warning."),

View File

@@ -14,6 +14,7 @@ import de.cotto.lndmanagej.ui.dto.BalanceInformationModel;
import de.cotto.lndmanagej.ui.dto.ChannelDetailsDto;
import de.cotto.lndmanagej.ui.dto.NodeDto;
import de.cotto.lndmanagej.ui.dto.OpenChannelDto;
import de.cotto.lndmanagej.ui.dto.PendingOpenChannelDto;
import de.cotto.lndmanagej.ui.dto.warning.DashboardWarningDto;
import de.cotto.lndmanagej.ui.page.channel.ChannelDetailsPage;
import de.cotto.lndmanagej.ui.page.channel.ChannelsPage;
@@ -47,10 +48,10 @@ import static de.cotto.lndmanagej.ui.dto.NodeDetailsDtoFixture.NODE_DETAILS_MODE
import static de.cotto.lndmanagej.ui.dto.NodeDtoFixture.NODE_DTO;
import static de.cotto.lndmanagej.ui.dto.NodeDtoFixture.NODE_DTO_2;
import static de.cotto.lndmanagej.ui.dto.NodeDtoFixture.NODE_DTO_3;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.CAPACITY_SAT;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.OPEN_CHANNEL_DTO2;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.UNANNOUNCED_CHANNEL;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.CAPACITY_SAT;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.OPEN_CHANNEL_DTO2;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.UNANNOUNCED_CHANNEL;
import static de.cotto.lndmanagej.ui.dto.PendingOpenChannelDtoFixture.PENDING_OPEN_CHANNEL_DTO;
import static de.cotto.lndmanagej.ui.dto.warning.DashboardWarningsFixture.DASHBOARD_WARNING;
import static de.cotto.lndmanagej.ui.dto.warning.DashboardWarningsFixture.DASHBOARD_WARNING_2;
@@ -194,7 +195,7 @@ class PageServiceTest {
@Test
void pendingChannels() {
var channels = List.of(PENDING_OPEN_CHANNEL_DTO);
List<PendingOpenChannelDto> channels = List.of(PENDING_OPEN_CHANNEL_DTO);
when(dataService.getPendingOpenChannels()).thenReturn(channels);
assertThat(pageService.pendingChannels()).usingRecursiveComparison()
.isEqualTo(new PendingChannelsPage(channels));

View File

@@ -1,6 +1,6 @@
package de.cotto.lndmanagej.ui.dto;
public class BalanceInformationModelFixture {
public class BalanceInformationModelFixtures {
public static final BalanceInformationModel BALANCE_INFORMATION_MODEL =
new BalanceInformationModel(1_000, 100, 900, 123, 10, 113);

View File

@@ -18,8 +18,8 @@ import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNE
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 de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixture.CAPACITY_SAT;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.OpenChannelDtoFixtures.CAPACITY_SAT;
public class ChannelDetailsDtoFixture {

View File

@@ -18,7 +18,7 @@ import static de.cotto.lndmanagej.model.OnChainCostsFixtures.ON_CHAIN_COSTS;
import static de.cotto.lndmanagej.model.OnlineReportFixtures.ONLINE_REPORT;
import static de.cotto.lndmanagej.model.RebalanceReportFixtures.REBALANCE_REPORT;
import static de.cotto.lndmanagej.model.warnings.ChannelWarningsFixtures.CHANNEL_WARNINGS;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.ClosedChannelDtoFixture.CLOSED_CHANNEL_DTO;
public class NodeDetailsDtoFixture {

View File

@@ -10,10 +10,10 @@ import static de.cotto.lndmanagej.model.PolicyFixtures.POLICIES_FOR_LOCAL_CHANNE
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_3;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixture.BALANCE_INFORMATION_MODEL_2;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL;
import static de.cotto.lndmanagej.ui.dto.BalanceInformationModelFixtures.BALANCE_INFORMATION_MODEL_2;
public class OpenChannelDtoFixture {
public class OpenChannelDtoFixtures {
public static final long CAPACITY_SAT = 21_000_000;

View File

@@ -57,7 +57,7 @@ class ArchUnitIT {
rule.check(importedClasses);
}
private static class DoNotIncludeTestClasses implements ImportOption {
private static final class DoNotIncludeTestClasses implements ImportOption {
private static final Pattern GRADLE_PATTERN = Pattern.compile(".*/build/classes/([^/]+/)?[a-zA-Z-]*[tT]est/.*");
@Override