Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isTrue\(\)
Replace with : assertThat($1).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isFalse\(\)
Replace with : assertThat($1).isNotEmpty()

Closes gh-31758
This commit is contained in:
Yanming Zhou
2023-12-06 09:34:06 +08:00
committed by Brian Clozel
parent 7b16ef90f1
commit afcd03bddc
55 changed files with 135 additions and 134 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public class CorsRegistryTests {
@Test
public void noMapping() {
assertThat(this.registry.getCorsConfigurations().isEmpty()).isTrue();
assertThat(this.registry.getCorsConfigurations()).isEmpty();
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,27 +28,27 @@ public class ExchangeStrategiesTests {
@Test
public void empty() {
ExchangeStrategies strategies = ExchangeStrategies.empty().build();
assertThat(strategies.messageReaders().isEmpty()).isTrue();
assertThat(strategies.messageWriters().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isEmpty();
assertThat(strategies.messageWriters()).isEmpty();
}
@Test
public void withDefaults() {
ExchangeStrategies strategies = ExchangeStrategies.withDefaults();
assertThat(strategies.messageReaders().isEmpty()).isFalse();
assertThat(strategies.messageWriters().isEmpty()).isFalse();
assertThat(strategies.messageReaders()).isNotEmpty();
assertThat(strategies.messageWriters()).isNotEmpty();
}
@Test
@SuppressWarnings("deprecation")
public void mutate() {
ExchangeStrategies strategies = ExchangeStrategies.empty().build();
assertThat(strategies.messageReaders().isEmpty()).isTrue();
assertThat(strategies.messageWriters().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isEmpty();
assertThat(strategies.messageWriters()).isEmpty();
ExchangeStrategies mutated = strategies.mutate().codecs(codecs -> codecs.registerDefaults(true)).build();
assertThat(mutated.messageReaders().isEmpty()).isFalse();
assertThat(mutated.messageWriters().isEmpty()).isFalse();
assertThat(mutated.messageReaders()).isNotEmpty();
assertThat(mutated.messageWriters()).isNotEmpty();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -298,13 +298,13 @@ class DefaultServerResponseBuilderTests {
.cookie(ResponseCookie.from("foo", "bar").build())
.bodyValue("body");
assertThat(serverResponse.block().cookies().isEmpty()).isFalse();
assertThat(serverResponse.block().cookies()).isNotEmpty();
serverResponse = ServerResponse.ok()
.cookie(ResponseCookie.from("foo", "bar").build())
.bodyValue("body");
assertThat(serverResponse.block().cookies().isEmpty()).isFalse();
assertThat(serverResponse.block().cookies()).isNotEmpty();
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,17 +28,17 @@ public class HandlerStrategiesTests {
@Test
public void empty() {
HandlerStrategies strategies = HandlerStrategies.empty().build();
assertThat(strategies.messageReaders().isEmpty()).isTrue();
assertThat(strategies.messageWriters().isEmpty()).isTrue();
assertThat(strategies.viewResolvers().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isEmpty();
assertThat(strategies.messageWriters()).isEmpty();
assertThat(strategies.viewResolvers()).isEmpty();
}
@Test
public void withDefaults() {
HandlerStrategies strategies = HandlerStrategies.withDefaults();
assertThat(strategies.messageReaders().isEmpty()).isFalse();
assertThat(strategies.messageWriters().isEmpty()).isFalse();
assertThat(strategies.viewResolvers().isEmpty()).isTrue();
assertThat(strategies.messageReaders()).isNotEmpty();
assertThat(strategies.messageWriters()).isNotEmpty();
assertThat(strategies.viewResolvers()).isEmpty();
}
}