FactIdentifier { public String getPackageWithoutClassName() { if (className.contains(".")) { return className.substring(0, className.lastIndexOf(".")); } else { return ""; } } 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 getPackageWithoutClassName() { FactIdentifier factIdentifier = new FactIdentifier("test", "com.Test"); assertEquals(factIdentifier.getPackageWithoutClassName(), "com"); }
@Test public void getPackageWithoutClassName_LongPackage() { FactIdentifier factIdentifier = new FactIdentifier("test", "com.project.Test"); assertEquals(factIdentifier.getPackageWithoutClassName(), "com.project"); }
@Test public void getPackageWithoutClassName_NoPackage() { FactIdentifier factIdentifier = new FactIdentifier("test", "Test"); assertEquals(factIdentifier.getPackageWithoutClassName(), ""); }