### Question:
MetadataEntityManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public void deleteMetadataEntitiesInProject(Long projectId, String entityClassName) { Objects.requireNonNull(projectId); if (StringUtils.hasText(entityClassName)) { MetadataClass metadataClass = loadClass(entityClassName); metadataEntityDao.deleteMetadataClassFromProject(projectId, metadataClass.getId()); } else { metadataEntityDao.deleteMetadataFromFolder(projectId); } }  Map<String, Integer> loadRootMetadataEntities(); @Transactional(propagation = Propagation.REQUIRED) MetadataClass createMetadataClass(final String className); List<MetadataClass> loadAllMetadataClasses(); MetadataClass loadClass(String name); MetadataClass loadClass(Long id); @Transactional(propagation = Propagation.REQUIRED) MetadataClass deleteMetadataClass(Long id); @Transactional(propagation = Propagation.REQUIRED) MetadataClass updateExternalClassName(Long id, FireCloudClass externalClassName); @Transactional(propagation = Propagation.REQUIRED) MetadataEntity updateMetadataEntity(MetadataEntityVO metadataEntityVO); @Override MetadataEntity load(Long id); @Override Integer loadTotalCount(); @Override Collection<? extends AbstractSecuredEntity> loadAllWithParents(Integer page, Integer pageSize); @Override MetadataEntity loadWithParents(final Long id); List<MetadataEntity> loadMetadataEntityByClassNameAndFolderId(Long id, String className); @Transactional(propagation = Propagation.REQUIRED) MetadataEntity updateMetadataItemKey(MetadataEntityVO metadataEntityVO); @Transactional(propagation = Propagation.REQUIRED) void insertCopiesOfExistentMetadataEntities(Long existentParentId, Long parentIdToAdd); @Transactional(propagation = Propagation.REQUIRED) MetadataEntity deleteMetadataEntity(Long id); @Transactional(propagation = Propagation.REQUIRED) MetadataEntity deleteMetadataItemKey(Long id, String key); @Transactional(propagation = Propagation.REQUIRED) Set<Long> deleteMetadataEntities(Set<Long> entitiesIds); @Transactional(propagation = Propagation.REQUIRED) void deleteMetadataEntitiesInProject(Long projectId, String entityClassName); @Transactional(propagation = Propagation.REQUIRED) void deleteMetadataFromFolder(Long folderId); MetadataEntity loadByExternalId(String id, String className, Long folderId); PagedResult<List<MetadataEntity>> filterMetadata(MetadataFilter filter); List<MetadataField> getMetadataKeys(Long folderId, String className); Collection<MetadataClassDescription> getMetadataFields(Long folderId); Set<MetadataEntity> getExistingEntities(Set<String> externalIds, Long folderId, String className); Set<MetadataEntity> loadEntitiesByIds(Set<Long> ids); Map<String, String> loadEntitiesData(Set<Long> ids); @Transactional(propagation = Propagation.REQUIRED) List<MetadataEntity> createAndUpdateEntities(Long parentId, MetadataParsingResult parsedData); @Transactional(propagation = Propagation.REQUIRED) void updateMetadataEntities(List<MetadataEntity> metadataEntities); List<MetadataEntity> loadReferencesForEntities(List<Long> entityIds, Long parentId); @Override AbstractSecuredEntity loadByNameOrId(String identifier); @Override AbstractSecuredEntity changeOwner(Long id, String owner); @Override AclClass getSupportedClass();  }### Answer:
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void shouldDeleteAllMetadataInFolderWithoutClassProvided() { entityManager.deleteMetadataEntitiesInProject(folder.getId(), null); assertTrue(loadEntities(SAMPLE_CLASS, folder.getId()).isEmpty()); assertTrue(loadEntities(PAIR_CLASS, folder.getId()).isEmpty()); }
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void shouldDeleteOnlyClassMetadataInFolderWithClassProvided() { entityManager.deleteMetadataEntitiesInProject(folder.getId(), SAMPLE_CLASS); assertTrue(loadEntities(SAMPLE_CLASS, folder.getId()).isEmpty()); assertEquals(1, loadEntities(PAIR_CLASS, folder.getId()).size()); }