VWOUtils { public static boolean isValidVwoAppKey(String appKey) { String regex = "[\\w]{32}-[0-9]+"; Pattern pattern = Pattern.compile(regex); return !TextUtils.isEmpty(appKey) && pattern.matcher(appKey).matches(); }  static boolean isValidVwoAppKey(String appKey); static String getDeviceUUID(VWOPreference vwoPreference); static String androidVersion(); static boolean isTablet(@NonNull Context context); static int applicationVersion(Context context); static double getRandomNumber(); static boolean checkForInternetPermissions(Context context); static Calendar getCalendar(); static boolean checkIfClassExists(String className); static String getDeviceName(); static boolean isApplicationDebuggable(@NonNull Context context); static int getScreenWidth(); static int getScreenHeight(); static double getScale(Context context); static String getDeviceCountryCode(Context context); @Nullable static String toMD5Hash(String message);  }
@Test public void testValidateApiKey() { Assert.assertFalse(VWOUtils.isValidVwoAppKey("ab123c12def23234")); Assert.assertFalse(VWOUtils.isValidVwoAppKey("aamk23sjcnd-1234")); Assert.assertTrue(VWOUtils.isValidVwoAppKey("abcnhdz3424234rh348ghginlaie7te4-23423")); Assert.assertFalse(VWOUtils.isValidVwoAppKey("")); Assert.assertFalse(VWOUtils.isValidVwoAppKey(null)); Assert.assertFalse(VWOUtils.isValidVwoAppKey("-123")); Assert.assertFalse(VWOUtils.isValidVwoAppKey("abc-")); Assert.assertFalse(VWOUtils.isValidVwoAppKey("abcnhdz3424234rh348ghginlaie7te4-")); Assert.assertFalse(VWOUtils.isValidVwoAppKey("-")); Assert.assertFalse(VWOUtils.isValidVwoAppKey("abcnhdz3424234rh348ghginlaie7te4-abc")); }