GenerateHubTDETemplateCommand extends GenerateModelArtifactsCommand { protected List<File> findEntityFiles() { List<File> entities = new ArrayList<>(); Path entitiesPath = hubConfig.getHubEntitiesDir(); File[] entityDefs = entitiesPath.toFile().listFiles(pathname -> pathname.toString().endsWith(ENTITY_FILE_EXTENSION) && !pathname.isHidden()); if (entityDefs != null) { entities.addAll(Arrays.asList(entityDefs)); } return entities; } GenerateHubTDETemplateCommand(HubConfig hubConfig); @Override void execute(CommandContext context); String getEntityNames(); void setEntityNames(String entityNames);  }
@Test public void testFindEntityFilesNoEntityFiles() { List<File> entityFiles = GenerateHubTDETemplateCommand.findEntityFiles(); assertEquals("Expected to find no entity files",0,entityFiles.size()); }
@Test public void testFindEntityFilesOneEntityFiles() { installEntity("myfirst"); List<File> entityFiles = GenerateHubTDETemplateCommand.findEntityFiles(); assertEquals("Expected to find one entity file",1,entityFiles.size()); }
@Test public void testFindEntityFilesTwoEntityFiles() { installEntity("myfirst"); installEntity("mysecond"); List<File> entityFiles = GenerateHubTDETemplateCommand.findEntityFiles(); assertEquals("Expected to find two entity files",2,entityFiles.size()); }