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
void deserialization() throws Exception {
String json = """
{
"data": {
"txId": "%s",
"blockIndex": %d,
"fee": %d,
"blockHeight": %d
}
}
{\
"data": {\
"txId": "%s",\
"blockIndex": %d,\
"fee": %d,\
"blockHeight": %d\
}\
}\
""".formatted(
TRANSACTION_HASH, POSITION_IN_BLOCK, FEES.satoshis(), BLOCK_HEIGHT
);
@@ -31,4 +31,4 @@ class BitapsTransactionDtoTest {
objectMapper.readValue(json, BitapsTransactionDto.class);
assertThat(bitapsTransactionDto.toModel()).isEqualTo(TRANSACTION);
}
}
}

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,7 @@ class LegacyControllerTest {
when(nodeService.getAlias(PUBKEY_3)).thenReturn(ALIAS_3);
when(channelService.getOpenChannels()).thenReturn(Set.of(LOCAL_OPEN_CHANNEL, LOCAL_OPEN_CHANNEL_TO_NODE_3));
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_4, PUBKEY_3, padded(CAPACITY_2), padded(balance2), padded(ppm2), ALIAS_3
));