VersionUtil { public static boolean isQualifierValid(String qualifier) { return qualifier != null && QUALIFIER_PATTERN.matcher(qualifier).matches(); } private  VersionUtil(); static boolean isSnapshot(String version); static boolean isValid(String version); static void isValidOrFail(String version); static Version parseVersion(String version); static int compare(String versionLeft, String versionRight); static boolean isQualifierValid(String qualifier); static void isQualifierValidOrFail(String qualifier); static final String DEFAULT_VERSION_NAME; static final Pattern VERSION_PATTERN; static final String SNAPSHOT_IDENTIFIER; static final Pattern QUALIFIER_PATTERN; }
@Test public void isQualifierValid() throws Exception { Assert.assertTrue(VersionUtil.isQualifierValid("toto")); Assert.assertTrue(VersionUtil.isQualifierValid("123")); Assert.assertTrue(VersionUtil.isQualifierValid("toto123")); Assert.assertTrue(VersionUtil.isQualifierValid("toto-233")); Assert.assertTrue(VersionUtil.isQualifierValid("toto_233")); Assert.assertFalse(VersionUtil.isQualifierValid("1cd&&")); Assert.assertFalse(VersionUtil.isQualifierValid("snapshot")); Assert.assertFalse(VersionUtil.isQualifierValid("DEV-snapshot")); Assert.assertFalse(VersionUtil.isQualifierValid("DEV-SNAPSHOT")); Assert.assertFalse(VersionUtil.isQualifierValid("Dev-SnAPSHoT-toto")); }