### Question:
CategoricalAttributeManager { @Transactional(propagation = Propagation.REQUIRED) public void syncWithMetadata() { final List<CategoricalAttribute> fullMetadataDict = metadataManager.buildFullMetadataDict(); insertAttributesValues(fullMetadataDict); }  @Transactional(propagation = Propagation.REQUIRED) boolean updateCategoricalAttributes(final List<CategoricalAttribute> dict); @Transactional(propagation = Propagation.REQUIRED) boolean insertAttributesValues(final List<CategoricalAttribute> dict); List<CategoricalAttribute> loadAll(); CategoricalAttribute loadAllValuesForKey(final String key); @Transactional(propagation = Propagation.REQUIRED) boolean deleteAttributeValues(final String key); @Transactional(propagation = Propagation.REQUIRED) boolean deleteAttributeValue(final String key, final String value); @Transactional(propagation = Propagation.REQUIRED) void syncWithMetadata();  }### Answer:
@Test @Transactional public void syncWithMetadata() { Assert.assertEquals(0, categoricalAttributeManager.loadAll().size()); final PipelineUser testUser = userManager .createUser(TEST_USER, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), null); final EntityVO entityVO = new EntityVO(testUser.getId(), AclClass.PIPELINE_USER); final Map<String, PipeConfValue> data = new HashMap<>(); data.put(KEY_1, new PipeConfValue(TYPE, VALUE_1)); data.put(KEY_2, new PipeConfValue(TYPE, VALUE_2)); data.put(SENSITIVE_KEY, new PipeConfValue(TYPE, VALUE_2)); final MetadataVO metadataVO = new MetadataVO(); metadataVO.setEntity(entityVO); metadataVO.setData(data); metadataManager.updateMetadataItem(metadataVO); categoricalAttributeManager.syncWithMetadata(); final Map<String, List<String>> categoricalAttributesAfterSync = categoricalAttributeManager.loadAll().stream() .collect(Collectors.toMap(CategoricalAttribute::getKey, attribute -> attribute.getValues().stream() .map(CategoricalAttributeValue::getValue) .collect(Collectors.toList()))); Assert.assertEquals(2, categoricalAttributesAfterSync.size()); Assert.assertThat(categoricalAttributesAfterSync.get(KEY_1), CoreMatchers.is(Collections.singletonList(VALUE_1))); Assert.assertThat(categoricalAttributesAfterSync.get(KEY_2), CoreMatchers.is(Collections.singletonList(VALUE_2))); Assert.assertFalse(categoricalAttributesAfterSync.containsKey(SENSITIVE_KEY)); }