List of usage examples for org.apache.commons.lang3 BooleanUtils negate
public static Boolean negate(final Boolean bool)
Negates the specified boolean.
If null is passed in, null will be returned.
NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean.
From source file:yoyo.framework.standard.shared.commons.lang.BooleanUtilsTest.java
@Test public void test() { assertThat(BooleanUtils.and(new boolean[] { true }), is(true)); assertThat(BooleanUtils.and(new boolean[] { true, false }), is(false)); assertThat(BooleanUtils.isFalse(false), is(true)); assertThat(BooleanUtils.isNotFalse(false), is(false)); assertThat(BooleanUtils.isNotTrue(true), is(false)); assertThat(BooleanUtils.isTrue(true), is(true)); assertThat(BooleanUtils.negate(Boolean.FALSE), is(true)); assertThat(BooleanUtils.or(new boolean[] { true }), is(true)); assertThat(BooleanUtils.or(new boolean[] { true, false }), is(true)); assertThat(BooleanUtils.toBoolean(Boolean.TRUE), is(true)); assertThat(BooleanUtils.toBoolean(0), is(false)); assertThat(BooleanUtils.toBoolean(1), is(true)); assertThat(BooleanUtils.toBoolean((String) null), is(false)); assertThat(BooleanUtils.toBoolean("true"), is(true)); assertThat(BooleanUtils.toBoolean("hoge"), is(false)); assertThat(BooleanUtils.toBooleanDefaultIfNull(null, false), is(false)); assertThat(BooleanUtils.toBooleanObject(0), is(Boolean.FALSE)); assertThat(BooleanUtils.toBooleanObject(1), is(Boolean.TRUE)); assertThat(BooleanUtils.toInteger(true), is(1)); assertThat(BooleanUtils.toInteger(false), is(0)); assertThat(BooleanUtils.toIntegerObject(true), is(Integer.valueOf(1))); assertThat(BooleanUtils.toIntegerObject(false), is(Integer.valueOf(0))); assertThat(BooleanUtils.toString(true, "true", "false"), is("true")); assertThat(BooleanUtils.toString(false, "true", "false"), is("false")); assertThat(BooleanUtils.toStringOnOff(true), is("on")); assertThat(BooleanUtils.toStringOnOff(false), is("off")); assertThat(BooleanUtils.toStringTrueFalse(true), is("true")); assertThat(BooleanUtils.toStringTrueFalse(false), is("false")); assertThat(BooleanUtils.toStringYesNo(true), is("yes")); assertThat(BooleanUtils.toStringYesNo(false), is("no")); assertThat(BooleanUtils.xor(new boolean[] { true }), is(true)); assertThat(BooleanUtils.xor(new boolean[] { true, false }), is(true)); assertThat(BooleanUtils.xor(new boolean[] { true, true }), is(false)); }