Replace assertThat(x.equals(y)) with assertThat(x).isEqualTo(y)

Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isTrue\(\)
Replace with : assertThat($1).isEqualTo($2)

Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isFalse\(\)
Replace with : assertThat($1).isNotEqualTo($2)

Closes gh-31763
This commit is contained in:
Yanming Zhou
2023-12-06 14:44:43 +08:00
committed by Brian Clozel
parent e2852e7355
commit 7b16ef90f1
30 changed files with 151 additions and 151 deletions

View File

@@ -142,13 +142,13 @@ public class WebMvcConfigurationSupportTests {
assertThat(handlerMappings.containsKey("defaultServletHandlerMapping")).isFalse();
Object nullBean = context.getBean("viewControllerHandlerMapping");
assertThat(nullBean.equals(null)).isTrue();
assertThat(nullBean).isEqualTo(null);
nullBean = context.getBean("resourceHandlerMapping");
assertThat(nullBean.equals(null)).isTrue();
assertThat(nullBean).isEqualTo(null);
nullBean = context.getBean("defaultServletHandlerMapping");
assertThat(nullBean.equals(null)).isTrue();
assertThat(nullBean).isEqualTo(null);
}
@Test

View File

@@ -251,7 +251,7 @@ class RequestMappingInfoTests {
.consumes("text/plain").produces("text/plain")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
info2 = infoBuilder.paths("/foo").methods(GET, RequestMethod.POST)
@@ -259,7 +259,7 @@ class RequestMappingInfoTests {
.consumes("text/plain").produces("text/plain")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
info2 = infoBuilder.paths("/foo").methods(GET)
@@ -267,7 +267,7 @@ class RequestMappingInfoTests {
.consumes("text/plain").produces("text/plain")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
info2 = infoBuilder.paths("/foo").methods(GET)
@@ -275,7 +275,7 @@ class RequestMappingInfoTests {
.consumes("text/plain").produces("text/plain")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
info2 = infoBuilder.paths("/foo").methods(GET)
@@ -283,7 +283,7 @@ class RequestMappingInfoTests {
.consumes("text/NOOOOOO").produces("text/plain")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
info2 = infoBuilder.paths("/foo").methods(GET)
@@ -291,7 +291,7 @@ class RequestMappingInfoTests {
.consumes("text/plain").produces("text/NOOOOOO")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
info2 = infoBuilder.paths("/foo").methods(GET)
@@ -299,7 +299,7 @@ class RequestMappingInfoTests {
.consumes("text/plain").produces("text/plain")
.build();
assertThat(info1.equals(info2)).isFalse();
assertThat(info1).isNotEqualTo(info2);
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
}

View File

@@ -231,8 +231,8 @@ public class BaseViewTests {
String kingval = "";
v.setAttributesCSV("foo=(" + fooval + "),king={" + kingval + "},f1=[we]");
assertThat(v.getStaticAttributes()).hasSize(3);
assertThat(v.getStaticAttributes().get("foo").equals(fooval)).isTrue();
assertThat(v.getStaticAttributes().get("king").equals(kingval)).isTrue();
assertThat(v.getStaticAttributes().get("foo")).isEqualTo(fooval);
assertThat(v.getStaticAttributes().get("king")).isEqualTo(kingval);
}
@Test