### Question:
BooleanType implements Type, Serializable { @Override public Object cast(Object obj) { Boolean value = null; if (obj != null) { if (obj instanceof Boolean) { value = (Boolean) obj; } else if (obj instanceof Number) { value = ((Number) obj).intValue() != 0; } else if (obj instanceof String) { value = Boolean.valueOf((String) obj); } else { throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, obj.toString()); } } return value; } private  BooleanType(); @Override String getName(); @Override boolean supportsEq(); @Override boolean supportsOrdering(); @Override JsonNode toJson(JsonNodeFactory factory, Object obj); @Override Object fromJson(JsonNode node); @Override Object cast(Object obj); @SuppressWarnings({"rawtypes", "unchecked"}) @Override int compare(Object v1, Object v2); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static final Type TYPE; static final String NAME; }### Answer:
@Test public void testCastNull() { assertNull(booleanType.cast(null)); }
@Test public void testCastBigInteger() { assertTrue(booleanType.cast(BigInteger.ONE) instanceof Boolean); }
@Test public void testCastLong() { Long laung = Long.MAX_VALUE; assertTrue(booleanType.cast(laung) instanceof Boolean); }
@Test public void testCastBooleanTrue() { assertTrue(booleanType.cast(Boolean.TRUE) instanceof Boolean); }
@Test public void testCastBooleanFalse() { assertTrue(booleanType.cast(Boolean.FALSE) instanceof Boolean); }
@Test(expected = Error.class) public void testCastOther() { Object object = new Object(); booleanType.cast(object); }