### Question:
PackageClass { public String getCanonicalName() { if (pkg == null) { return fileName; } return pkg + "." + fileName; } protected  PackageClass(String fullyQualifiedName);  PackageClass(String pkg, String fileName);  PackageClass(Class<?> inputClass); String getClassName(); String getFullyQualifiedName(); String getPackage(); PackageClass append(String addName); PackageClass prepend(String prepend); PackageClass replaceName(String replacement); String toString(); @Override boolean equals(Object obj); @Override int hashCode(); String getCanonicalName(); PackageClass replacePackage(String inputPackage);  }### Answer:
@Test public void testNoPackage() { PackageClass packageClass = new PackageClass(CLASS_NAME); assertEquals(CLASS_NAME, packageClass.getCanonicalName()); }
@Test public void testClassNameParsing() { PackageClass packageClass = new PackageClass(FULLY_QUALIFIED_NAME); assertEquals(FULLY_QUALIFIED_NAME, packageClass.getCanonicalName()); }
@Test public void testSeparateClassPackage() { PackageClass packageClass = new PackageClass(PACKAGE_NAME, CLASS_NAME); assertEquals(FULLY_QUALIFIED_NAME, packageClass.getCanonicalName()); }
@Test public void testDotJavaRemoval() { PackageClass packageClass = new PackageClass(FULLY_QUALIFIED_NAME + DOT_JAVA); assertEquals(FULLY_QUALIFIED_NAME, packageClass.getCanonicalName()); }