VirtualAssetService { @Transactional public void deleteTextUnit(Long assetId, String name) { Asset asset = assetRepository.findById(assetId).orElse(null); deleteTextUnits(asset, Arrays.asList(name)); }  @Transactional VirtualAsset createOrUpdateVirtualAsset(VirtualAsset virtualAsset); List<VirtualAssetTextUnit> getTextUnits(long assetId, Boolean doNotTranslateFilter); @Transactional List<VirtualAssetTextUnit> getLocalizedTextUnits(
            long assetId,
            long localeId,
            InheritanceMode inheritanceMode); PollableFuture<Void> addTextUnits(long assetId, List<VirtualAssetTextUnit> virtualAssetTextUnits); PollableFuture<Void> replaceTextUnits(long assetId, List<VirtualAssetTextUnit> virtualAssetTextUnits); PollableFuture<Void> importLocalizedTextUnits(
            long assetId,
            long localeId,
            List<VirtualAssetTextUnit> textUnitForVirtualAssets); @Transactional void deleteTextUnit(Long assetId, String name); void deleteTextUnits(Asset asset, List<String> names); TMTextUnitVariant addTextUnitVariant(long assetId, long localeId, String name, String content, String comment);  }
@Test public void testDeleteTextUnit() throws Exception { Repository repository = repositoryService.createRepository(testIdWatcher.getEntityName("testDeleteTextUnit")); VirtualAsset virtualAsset = new VirtualAsset(); virtualAsset.setRepositoryId(repository.getId()); virtualAsset.setPath("default"); virtualAsset = virtualAssetService.createOrUpdateVirtualAsset(virtualAsset); virtualAssetService.addTextUnit( virtualAsset.getId(), "name_plural_other", "content plural", "comment plural", "other", "name_plural_other", false); virtualAssetService.addTextUnit( virtualAsset.getId(), "name", "content", "comment", null, null, false); List<VirtualAssetTextUnit> textUnits = virtualAssetService.getTextUnits(virtualAsset.getId(), null); assertEquals(2, textUnits.size()); virtualAssetService.deleteTextUnit(virtualAsset.getId(), "name_plural_other"); textUnits = virtualAssetService.getTextUnits(virtualAsset.getId(), null); assertEquals(1, textUnits.size()); assertEquals("name", textUnits.get(0).getName()); }