### Question:
MongoMetadataServiceImpl implements IMetadataService { @Override public MetaClass deleteMetaField(String className, String fieldName, MetadataContext metaContext) { long start = System.currentTimeMillis(); try { metadataLock.lock(); MetaClass meta = repo.getMetadataService().getMetaClass(className); if (meta == null) { throw new MetaClassNotExistsException(repo.getRepositoryName(), className); } Collection<MetaField> classFields = meta.getClassFields(); boolean existing = false; for (MetaField mf : classFields) { if (mf.getName().equals(fieldName)) { existing = true; break; } } if (!existing) { throw new MetaFieldNotExistsException(MessageFormat.format("MetaField {0} doesn't exist!", fieldName)); } MetaClass result = innerDropMetaField(meta, fieldName); addMetaHistory(meta, "deleteMetaField", metaContext); long duration = System.currentTimeMillis() - start; metaContext.addDbTimeCost(duration); return result; } catch (InterruptedException e) { logger.info("lock interrupted for deletaMetaField {}", className); throw new MetaDataException(MetaErrCodeEnum.LOCK_INTERRUPTED, "lock interrupted for deleteMetaField " + className, e); } finally { metadataLock.unlock(); } } MongoMetadataServiceImpl(Mongo mongo, int maxCacheSize,
            int cacheExpiredTime, int collectionCountCacheSize, int collectionCountCacheExpiredTime,
            Repository repo, ICMSLock metadataLock); @Override Repository getRepository(); @Override MetaClass getMetaClass(String className); @Override MetaClass getMetaClass(String className, int version, MetadataContext context); @Override MetaClass createMetaClass(MetaClass metaClass, MetadataContext context); @Override void deleteMetaClass(String className, MetadataContext metaContext); @Override MetaClass deleteMetaField(String className, String fieldName, MetadataContext metaContext); @Override MetaClass updateMetaClass(MetaClass metaClass, MetadataContext context); @Override List<MetaClass> batchUpsert(List<MetaClass> metaClasses, MetadataContext context); @Override final List<MetaClass> getMetaClasses(MetadataContext ctx); @Override void updateMetaOption(String className, MetaOption options, MetadataContext context); @Override int getCollectionCount(String dbCollectionName); @Override MetaClass updateMetaField(MetaClass metaClass, String fieldName, MetadataContext context); @Override void validateMetaClass(String className); @Override void setMetaHistoryService(IMetadataHistoryService historyService); static final Logger logger; }### Answer:
@Test public void testDeleteMetaField() { IMetadataService metaService = repositoryService.getRepository("software-deployment").getMetadataService(); MetadataContext metaContext = new MetadataContext(); String className = "ServiceCluster"; metaService.deleteMetaField(className, "name", metaContext); MetaClass meta = metaService.getMetaClass(className); Assert.assertNull(meta.getFieldByName("name")); }