ObjectFormatter implements IValueFormatter { @Override public boolean acceptType(Type type, Map<String, Object> options) { if (type == null) { return false; } char tag = type.signature().charAt(0); return (tag == OBJECT) || (tag == ARRAY) || (tag == STRING) || (tag == THREAD) || (tag == THREAD_GROUP) || (tag == CLASS_LOADER) || (tag == CLASS_OBJECT); } ObjectFormatter(BiFunction<Type, Map<String, Object>, String> typeToStringFunction); @Override String toString(Object obj, Map<String, Object> options); @Override boolean acceptType(Type type, Map<String, Object> options); @Override Value valueOf(String value, Type type, Map<String, Object> options);  }
@Test public void testAcceptType() throws Exception { ObjectReference or = this.getObjectReference("Foo"); assertFalse("Should not accept null type.", formatter.acceptType(null, new HashMap<>())); assertTrue("Should accept Foo type.", formatter.acceptType(or.referenceType(), new HashMap<>())); ObjectReference str = this.getObjectReference("java.lang.String"); assertTrue("Should accept String type.", formatter.acceptType(str.referenceType(), new HashMap<>())); ObjectReference clz = this.getObjectReference("java.lang.Class"); assertTrue("Should accept Class type.", formatter.acceptType(clz.referenceType(), new HashMap<>())); LocalVariable list = this.getLocalVariable("strList"); assertTrue("Should accept List type.", formatter.acceptType(list.type(), new HashMap<>())); LocalVariable arrays = this.getLocalVariable("arrays"); assertTrue("Should accept array type.", formatter.acceptType(arrays.type(), new HashMap<>())); }