Replace assertThat(!x).isTrue() with assertThat(x).isFalse()

Search for   : assertThat\(!(.+)\).isTrue\(\)

Replace with : assertThat(\1).isFalse()
This commit is contained in:
Sam Brannen
2023-12-05 11:41:57 +01:00
parent 21560bccd3
commit ceba4162bb
7 changed files with 58 additions and 58 deletions

View File

@@ -35,7 +35,7 @@ public abstract class AbstractPropertyValuesTests {
assertThat(pvs.contains("forname")).as("Contains forname").isTrue();
assertThat(pvs.contains("surname")).as("Contains surname").isTrue();
assertThat(pvs.contains("age")).as("Contains age").isTrue();
assertThat(!pvs.contains("tory")).as("Doesn't contain tory").isTrue();
assertThat(pvs.contains("tory")).as("Doesn't contain tory").isFalse();
PropertyValue[] ps = pvs.getPropertyValues();
Map<String, String> m = new HashMap<>();

View File

@@ -89,7 +89,7 @@ public class PropertyPathFactoryBeanTests {
TestBean spouse = (TestBean) xbf.getBean("otb.spouse");
TestBean tbWithInner = (TestBean) xbf.getBean("tbWithInner");
assertThat(tbWithInner.getSpouse()).isSameAs(spouse);
assertThat(!tbWithInner.getFriends().isEmpty()).isTrue();
assertThat(tbWithInner.getFriends().isEmpty()).isFalse();
assertThat(tbWithInner.getFriends().iterator().next()).isSameAs(spouse);
}

View File

@@ -35,8 +35,8 @@ public class BeanDefinitionTests {
bd.setLazyInit(true);
bd.setScope("request");
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.setAbstract(true);
otherBd.setLazyInit(true);
otherBd.setScope("request");
@@ -52,11 +52,11 @@ public class BeanDefinitionTests {
bd.getPropertyValues().add("age", "99");
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
otherBd.getPropertyValues().add("name", "myName");
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.getPropertyValues().add("age", "11");
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.getPropertyValues().add("age", "99");
assertThat(bd.equals(otherBd)).isTrue();
assertThat(otherBd.equals(bd)).isTrue();
@@ -70,11 +70,11 @@ public class BeanDefinitionTests {
bd.getConstructorArgumentValues().addIndexedArgumentValue(1, 5);
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
otherBd.getConstructorArgumentValues().addGenericArgumentValue("test");
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.getConstructorArgumentValues().addIndexedArgumentValue(1, 9);
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.getConstructorArgumentValues().addIndexedArgumentValue(1, 5);
assertThat(bd.equals(otherBd)).isTrue();
assertThat(otherBd.equals(bd)).isTrue();
@@ -89,11 +89,11 @@ public class BeanDefinitionTests {
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
otherBd.getConstructorArgumentValues().addGenericArgumentValue("test", "int");
otherBd.getConstructorArgumentValues().addIndexedArgumentValue(1, 5);
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.getConstructorArgumentValues().addIndexedArgumentValue(1, 5, "int");
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.getConstructorArgumentValues().addIndexedArgumentValue(1, 5, "long");
assertThat(bd.equals(otherBd)).isTrue();
assertThat(otherBd.equals(bd)).isTrue();
@@ -111,8 +111,8 @@ public class BeanDefinitionTests {
otherBd.setScope("request");
otherBd.setAbstract(true);
otherBd.setLazyInit(true);
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.setParentName("parent");
assertThat(bd.equals(otherBd)).isTrue();
assertThat(otherBd.equals(bd)).isTrue();
@@ -137,8 +137,8 @@ public class BeanDefinitionTests {
bd.setScope("request");
BeanDefinitionHolder holder = new BeanDefinitionHolder(bd, "bd");
RootBeanDefinition otherBd = new RootBeanDefinition(TestBean.class);
assertThat(!bd.equals(otherBd)).isTrue();
assertThat(!otherBd.equals(bd)).isTrue();
assertThat(bd.equals(otherBd)).isFalse();
assertThat(otherBd.equals(bd)).isFalse();
otherBd.setAbstract(true);
otherBd.setLazyInit(true);
otherBd.setScope("request");

View File

@@ -193,31 +193,31 @@ class CustomEditorTests {
bw.setPropertyValue("bool1", "false");
assertThat(Boolean.FALSE.equals(bw.getPropertyValue("bool1"))).as("Correct bool1 value").isTrue();
assertThat(!tb.isBool1()).as("Correct bool1 value").isTrue();
assertThat(tb.isBool1()).as("Correct bool1 value").isFalse();
bw.setPropertyValue("bool1", " true ");
assertThat(tb.isBool1()).as("Correct bool1 value").isTrue();
bw.setPropertyValue("bool1", " false ");
assertThat(!tb.isBool1()).as("Correct bool1 value").isTrue();
assertThat(tb.isBool1()).as("Correct bool1 value").isFalse();
bw.setPropertyValue("bool1", "on");
assertThat(tb.isBool1()).as("Correct bool1 value").isTrue();
bw.setPropertyValue("bool1", "off");
assertThat(!tb.isBool1()).as("Correct bool1 value").isTrue();
assertThat(tb.isBool1()).as("Correct bool1 value").isFalse();
bw.setPropertyValue("bool1", "yes");
assertThat(tb.isBool1()).as("Correct bool1 value").isTrue();
bw.setPropertyValue("bool1", "no");
assertThat(!tb.isBool1()).as("Correct bool1 value").isTrue();
assertThat(tb.isBool1()).as("Correct bool1 value").isFalse();
bw.setPropertyValue("bool1", "1");
assertThat(tb.isBool1()).as("Correct bool1 value").isTrue();
bw.setPropertyValue("bool1", "0");
assertThat(!tb.isBool1()).as("Correct bool1 value").isTrue();
assertThat(tb.isBool1()).as("Correct bool1 value").isFalse();
assertThatExceptionOfType(BeansException.class).isThrownBy(() ->
bw.setPropertyValue("bool1", "argh"));
@@ -234,25 +234,25 @@ class CustomEditorTests {
bw.setPropertyValue("bool2", "false");
assertThat(Boolean.FALSE.equals(bw.getPropertyValue("bool2"))).as("Correct bool2 value").isTrue();
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "on");
assertThat(tb.getBool2().booleanValue()).as("Correct bool2 value").isTrue();
bw.setPropertyValue("bool2", "off");
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "yes");
assertThat(tb.getBool2().booleanValue()).as("Correct bool2 value").isTrue();
bw.setPropertyValue("bool2", "no");
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "1");
assertThat(tb.getBool2().booleanValue()).as("Correct bool2 value").isTrue();
bw.setPropertyValue("bool2", "0");
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "");
assertThat(tb.getBool2()).as("Correct bool2 value").isNull();
@@ -270,25 +270,25 @@ class CustomEditorTests {
bw.setPropertyValue("bool2", "false");
assertThat(Boolean.FALSE.equals(bw.getPropertyValue("bool2"))).as("Correct bool2 value").isTrue();
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "on");
assertThat(tb.getBool2().booleanValue()).as("Correct bool2 value").isTrue();
bw.setPropertyValue("bool2", "off");
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "yes");
assertThat(tb.getBool2().booleanValue()).as("Correct bool2 value").isTrue();
bw.setPropertyValue("bool2", "no");
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "1");
assertThat(tb.getBool2().booleanValue()).as("Correct bool2 value").isTrue();
bw.setPropertyValue("bool2", "0");
assertThat(!tb.getBool2()).as("Correct bool2 value").isTrue();
assertThat(tb.getBool2()).as("Correct bool2 value").isFalse();
bw.setPropertyValue("bool2", "");
assertThat(bw.getPropertyValue("bool2")).as("Correct bool2 value").isNull();