ReportExporter { @Deprecated public void unexport(String name) { ObjectName objectName; try { objectName = new ObjectName(name); } catch (MalformedObjectNameException e) { throw new ReportException(Reason.MALFORMED_OBJECT_NAME, e.getMessage()); } unexport(objectName); } @Inject  ReportExporter(ReportedBeanRegistry registry, BucketIdProvider bucketIdProvider); void export(Object object, boolean applicationPrefix, String namePrefix, Map<String, String> tags); void unexportObject(Object object); @Deprecated void export(String name, Object object); @Deprecated void export(ObjectName objectName, Object object); @Deprecated void unexport(String name); @Deprecated void unexport(ObjectName objectName);  }
@Test public void testLegacyUnexportStringMalformedName() { try { reportExporter.unexport("TestingObject"); fail("expected ReportException"); } catch (ReportException e) { assertEquals(e.getReason(), Reason.MALFORMED_OBJECT_NAME); assertEquals(e.getMessage(), "Key properties cannot be empty"); } }
@Test public void testLegacyUnexportStringNotRegistered() { try { reportExporter.unexport(TESTING_OBJECT_NAME.getCanonicalName()); fail("expected ReportException"); } catch (ReportException e) { assertEquals(e.getReason(), Reason.INSTANCE_NOT_FOUND); assertEquals(e.getMessage(), "com.proofpoint.reporting:name=TestingObject not found"); } }
@Test public void testLegacyUnexportObjectNameNotRegistered() { try { reportExporter.unexport(TESTING_OBJECT_NAME); fail("expected ReportException"); } catch (ReportException e) { assertEquals(e.getReason(), Reason.INSTANCE_NOT_FOUND); assertEquals(e.getMessage(), "com.proofpoint.reporting:name=TestingObject not found"); } }