DataUtils { public static String getGroupId(final String gavc) { final int splitter = gavc.indexOf(':'); if(splitter == -1){ return gavc; } return gavc.substring(0, splitter); } 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 getGroupIdFromGavc(){ final String gavc1 = "groupId:artifactId:version:classifier:extension"; final String gavc2 = "test"; assertEquals("groupId", DataUtils.getGroupId(gavc1)); assertEquals("test", DataUtils.getGroupId(gavc2)); }