@Test public void testToString() throws Exception { Value boolVar = getVM().mirrorOf(true); Map<String, Object> options = formatter.getDefaultOptions(); assertEquals("Failed to format boolean type.", boolVar.type().name(), formatter.toString(boolVar.type(), options)); ObjectReference foo = this.getObjectReference("Foo"); assertEquals("Failed to format Foo type.", foo.type().name(), formatter.toString(foo.type(), options)); ObjectReference str = this.getObjectReference("java.lang.String"); assertEquals("Failed to format String type.", "String", formatter.toString(str.type(), options)); options.put(SimpleTypeFormatter.QUALIFIED_CLASS_NAME_OPTION, true); assertEquals("Failed to format boolean type.", boolVar.type().name(), formatter.toString(boolVar.type(), options)); assertEquals("Failed to format Foo type.", foo.type().name(), formatter.toString(foo.type(), options)); assertEquals("Failed to format String type.", "java.lang.String", formatter.toString(str.type(), options)); }
@Override public String toString(Object type, Map<String, Object> options) { if (type == null) { return NullObjectFormatter.NULL_STRING; } String typeName = ((Type) type).name(); return showQualifiedClassName(options) ? typeName : trimTypeName(typeName); }
SimpleTypeFormatter implements ITypeFormatter { @Override public String toString(Object type, Map<String, Object> options) { if (type == null) { return NullObjectFormatter.NULL_STRING; } String typeName = ((Type) type).name(); return showQualifiedClassName(options) ? typeName : trimTypeName(typeName); } }
SimpleTypeFormatter implements ITypeFormatter { @Override public String toString(Object type, Map<String, Object> options) { if (type == null) { return NullObjectFormatter.NULL_STRING; } String typeName = ((Type) type).name(); return showQualifiedClassName(options) ? typeName : trimTypeName(typeName); }  }
SimpleTypeFormatter implements ITypeFormatter { @Override public String toString(Object type, Map<String, Object> options) { if (type == null) { return NullObjectFormatter.NULL_STRING; } String typeName = ((Type) type).name(); return showQualifiedClassName(options) ? typeName : trimTypeName(typeName); }  @Override String toString(Object type, Map<String, Object> options); @Override boolean acceptType(Type type, Map<String, Object> options); @Override Map<String, Object> getDefaultOptions(); static String trimTypeName(String type); }
SimpleTypeFormatter implements ITypeFormatter { @Override public String toString(Object type, Map<String, Object> options) { if (type == null) { return NullObjectFormatter.NULL_STRING; } String typeName = ((Type) type).name(); return showQualifiedClassName(options) ? typeName : trimTypeName(typeName); }  @Override String toString(Object type, Map<String, Object> options); @Override boolean acceptType(Type type, Map<String, Object> options); @Override Map<String, Object> getDefaultOptions(); static String trimTypeName(String type); static final String QUALIFIED_CLASS_NAME_OPTION; }