public boolean containsMetadata(final String key) {
        if (getMetadata() == null || getMetadata().isEmpty()) {
            return false;
        }
        return getMetadata().containsKey(key);
    }
@Test
    void testContainsMetadata() {
        Instance instance = new Instance();
        assertFalse(instance.containsMetadata("a"));
        instance.setMetadata(null);
        assertFalse(instance.containsMetadata("a"));
        instance.addMetadata("a", "b");
        assertTrue(instance.containsMetadata("a"));
    }