FactIdentifier { public String getClassNameWithoutPackage() { if (className.contains(".")) { return className.substring(className.lastIndexOf(".") + 1); } else { return className; } } FactIdentifier();  FactIdentifier(String name, String className); String getName(); String getClassName(); String getClassNameWithoutPackage(); String getPackageWithoutClassName(); static FactIdentifier create(String name, String className); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static FactIdentifier INDEX; static FactIdentifier DESCRIPTION; static FactIdentifier EMPTY; }
@Test public void getClassNameWithoutPackage() { FactIdentifier factIdentifier = new FactIdentifier("test", "com.Test"); assertEquals(factIdentifier.getClassNameWithoutPackage(), "Test"); }
@Test public void getClassNameWithoutPackage_LongPackage() { FactIdentifier factIdentifier = new FactIdentifier("test", "com.project.Test"); assertEquals(factIdentifier.getClassNameWithoutPackage(), "Test"); }
@Test public void getClassNameWithoutPackage_NoPackage() { FactIdentifier factIdentifier = new FactIdentifier("test", "Test"); assertEquals(factIdentifier.getClassNameWithoutPackage(), "Test"); }