DataUtils { public static String getModuleVersion(final String moduleId) { final int splitter = moduleId.lastIndexOf(':'); if(splitter == -1){ return moduleId; } return moduleId.substring(splitter+1); } private  DataUtils(); static List<String> getAllArtifacts(final DbModule module); static Set<Artifact> getAllArtifacts(final Module module); static Set<Dependency> getAllDependencies(final Module module); static List<DbDependency> getAllDbDependencies(final DbModule module); static String getModuleName(final String moduleId); static String getModuleVersion(final String moduleId); static String getGroupId(final String gavc); static DbArtifact createDbArtifact(final String gavc); static Artifact createArtifact(final String gavc); static List<DbModule> getAllSubmodules(final DbModule module); static boolean isFullGAVC(final String entry); static String strip(final String gavc, final int stripCount); static void sort(final List<Artifact> targets);  }
@Test public void getModuleVersion(){ assertEquals("123", DataUtils.getModuleVersion(":123")); assertEquals("", DataUtils.getModuleVersion("modulename:")); assertEquals("123", DataUtils.getModuleVersion("modulename:123")); assertEquals("123", DataUtils.getModuleVersion("module:name:123")); assertEquals("modulename123", DataUtils.getModuleVersion("modulename123")); }