PortableParameterDefinition { public String getSimpleClassName() { String className = getClassName(); if ( className == null ) { return null; } int index = className.lastIndexOf( "." ); if ( index >= 0 ) { className = className.substring( index + 1 ); } return className; } PortableParameterDefinition();  PortableParameterDefinition( String name ); String getName(); void setName( String name ); abstract String asString(); abstract String getClassName(); String getSimpleClassName(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testSimpleClassNames() { PortableBooleanParameterDefinition p1 = new PortableBooleanParameterDefinition(); assertEquals( "Boolean", p1.getSimpleClassName() ); PortableEnumParameterDefinition p2 = new PortableEnumParameterDefinition(); p2.setClassName( "com.tests.example.Smurf" ); assertEquals( "Smurf", p2.getSimpleClassName() ); PortableFloatParameterDefinition p3 = new PortableFloatParameterDefinition(); assertEquals( "Float", p3.getSimpleClassName() ); PortableIntegerParameterDefinition p4 = new PortableIntegerParameterDefinition(); assertEquals( "Integer", p4.getSimpleClassName() ); PortableObjectParameterDefinition p5 = new PortableObjectParameterDefinition(); p5.setClassName( "com.tests.example.Smurf" ); assertEquals( "Smurf", p5.getSimpleClassName() ); PortableStringParameterDefinition p6 = new PortableStringParameterDefinition(); assertEquals( "String", p6.getSimpleClassName() ); }