public boolean addMetadataString(String rawMetadata) throws UnmarshallingException {
        InputStream inputStream = new ByteArrayInputStream(rawMetadata.getBytes(UTF_8));
        XMLObject metadata = super.unmarshallMetadata(inputStream);
        if (!isValid(metadata)) {
            return false;
        }

        if (metadata instanceof EntitiesDescriptor) {
            this.entitiesDescriptor = (EntitiesDescriptor) metadata;
        }

        if (metadata instanceof EntityDescriptor) {
            this.entityDescriptor = (EntityDescriptor) metadata;
        }

        return true;
    }
@Test
    public void addInvalidMetadataStringTest() throws UnmarshallingException {
        assertFalse(stringMetadataResolver.addMetadataString(invalidMetadata));
    }