work around linebreak issue found by spotbugs

This commit is contained in:
Carsten Otto
2024-06-07 11:52:57 +02:00
parent bfbd482821
commit d305a57ecc
5 changed files with 65 additions and 65 deletions

View File

@@ -16,14 +16,14 @@ class BitapsTransactionDtoTest {
@Test @Test
void deserialization() throws Exception { void deserialization() throws Exception {
String json = """ String json = """
{ {\
"data": { "data": {\
"txId": "%s", "txId": "%s",\
"blockIndex": %d, "blockIndex": %d,\
"fee": %d, "fee": %d,\
"blockHeight": %d "blockHeight": %d\
} }\
} }\
""".formatted( """.formatted(
TRANSACTION_HASH, POSITION_IN_BLOCK, FEES.satoshis(), BLOCK_HEIGHT TRANSACTION_HASH, POSITION_IN_BLOCK, FEES.satoshis(), BLOCK_HEIGHT
); );

View File

@@ -16,41 +16,41 @@ class BlockcypherTransactionDtoTest {
@Test @Test
void deserialization() throws Exception { void deserialization() throws Exception {
String json = """ String json = """
{ {\
"block_height": %d, "block_height": %d,\
"hash": "%s", "hash": "%s",\
"fees": %d, "fees": %d,\
"confirmed": "2019-10-26T20:06:35Z", "confirmed": "2019-10-26T20:06:35Z",\
"received": "2019-10-26T20:06:34Z", "received": "2019-10-26T20:06:34Z",\
"block_index": %d, "block_index": %d,\
"inputs": [ "inputs": [\
{ {\
"output_value": 100, "output_value": 100,\
"addresses": [ "addresses": [\
"aaa" "aaa"\
] ]\
}, },\
{ {\
"output_value": 200, "output_value": 200,\
"addresses": [ "addresses": [\
"bbb" "bbb"\
] ]\
} }\
], ],\
"outputs": [ "outputs": [\
{ {\
"value": 123, "value": 123,\
"addresses": [ "addresses": [\
"abc" "abc"\
] ]\
}, },\
{ {\
"value": 456, "value": 456,\
"addresses": [ "addresses": [\
"def" "def"\
] ]\
} }\
] ]\
}""".formatted( }""".formatted(
BLOCK_HEIGHT, TRANSACTION_HASH, FEES.satoshis(), POSITION_IN_BLOCK BLOCK_HEIGHT, TRANSACTION_HASH, FEES.satoshis(), POSITION_IN_BLOCK
); );

View File

@@ -45,16 +45,16 @@ class RatingControllerIT {
webTestClient.get().uri(PREFIX + "/node/" + PUBKEY + RATING).exchange() webTestClient.get().uri(PREFIX + "/node/" + PUBKEY + RATING).exchange()
.expectBody() .expectBody()
.json(""" .json("""
{ {\
"rating": 128, "rating": 128,\
"message": "", "message": "",\
"descriptions": { "descriptions": {\
"%s rating": "128", "%s rating": "128",\
"%s raw rating": "123", "%s raw rating": "123",\
"%s something": "123", "%s something": "123",\
"%s raw rating": "5", "%s raw rating": "5",\
"%s something else": "5" "%s something else": "5"\
} }\
}""".formatted(PUBKEY, CHANNEL_ID, CHANNEL_ID, CHANNEL_ID_2, CHANNEL_ID_2)); }""".formatted(PUBKEY, CHANNEL_ID, CHANNEL_ID, CHANNEL_ID_2, CHANNEL_ID_2));
} }
@@ -72,14 +72,14 @@ class RatingControllerIT {
webTestClient.get().uri(PREFIX + "/channel/" + CHANNEL_ID + RATING).exchange() webTestClient.get().uri(PREFIX + "/channel/" + CHANNEL_ID + RATING).exchange()
.expectBody() .expectBody()
.json(""" .json("""
{ {\
"rating": 579, "rating": 579,\
"message": "", "message": "",\
"descriptions": { "descriptions": {\
"%s a": "456", "%s a": "456",\
"%s something": "123", "%s something": "123",\
"%s raw rating": "579" "%s raw rating": "579"\
} }\
}""".formatted(CHANNEL_ID, CHANNEL_ID, CHANNEL_ID)); }""".formatted(CHANNEL_ID, CHANNEL_ID, CHANNEL_ID));
} }

View File

@@ -167,7 +167,7 @@ public class PaymentsController {
} }
private String asString(InstantWithString instantWithString) { private String asString(InstantWithString instantWithString) {
return "{\"timestamp\":\"%s\",\"message\":\"%s\"}\n" return "{\"timestamp\":\"%s\",\"message\":\"%s\"}%n"
.formatted(instantWithString.instant(), instantWithString.string()); .formatted(instantWithString.instant(), instantWithString.string());
} }

View File

@@ -56,7 +56,7 @@ class LegacyControllerTest {
when(nodeService.getAlias(PUBKEY_3)).thenReturn(ALIAS_3); when(nodeService.getAlias(PUBKEY_3)).thenReturn(ALIAS_3);
when(channelService.getOpenChannels()).thenReturn(Set.of(LOCAL_OPEN_CHANNEL, LOCAL_OPEN_CHANNEL_TO_NODE_3)); when(channelService.getOpenChannels()).thenReturn(Set.of(LOCAL_OPEN_CHANNEL, LOCAL_OPEN_CHANNEL_TO_NODE_3));
assertThat(legacyController.getOpenChannelIdsPretty()) assertThat(legacyController.getOpenChannelIdsPretty())
.isEqualTo("%s\t%s %s %s %s %s\n%s\t%s %s %s %s %s".formatted( .isEqualTo("%s\t%s %s %s %s %s%n%s\t%s %s %s %s %s".formatted(
CHANNEL_ID_COMPACT, PUBKEY_2, padded(CAPACITY), padded(balance1), padded(ppm1), ALIAS_2, CHANNEL_ID_COMPACT, PUBKEY_2, padded(CAPACITY), padded(balance1), padded(ppm1), ALIAS_2,
CHANNEL_ID_COMPACT_4, PUBKEY_3, padded(CAPACITY_2), padded(balance2), padded(ppm2), ALIAS_3 CHANNEL_ID_COMPACT_4, PUBKEY_3, padded(CAPACITY_2), padded(balance2), padded(ppm2), ALIAS_3
)); ));