@Test public void auth_valid_negativeTextIgnoredIfDeviceCredentialsTrue() { Goldfinger.PromptParams params = new Goldfinger.PromptParams.Builder(activity) .title(TITLE) .deviceCredentialsAllowed(true) .build(); assertTrue(ValidateUtils.validatePromptParams(Mode.AUTHENTICATION, params).isEmpty()); }
@NonNull static List<String> validatePromptParams(@NonNull Mode mode, @NonNull Goldfinger.PromptParams params) { List<String> errors = new ArrayList<>(); if (!(params.dialogOwner() instanceof Fragment) && !(params.dialogOwner() instanceof FragmentActivity)) { errors.add("DialogOwner must be of instance Fragment or FragmentActivity"); } if (StringUtils.isBlankOrNull(params.title())) { errors.add("Title is required!"); } if (!params.deviceCredentialsAllowed() && StringUtils.isBlankOrNull(params.negativeButtonText())) { errors.add("NegativeButtonText is required!"); } if (params.deviceCredentialsAllowed() && mode != Mode.AUTHENTICATION) { errors.add("DeviceCredentials are allowed only for Goldfinger#authenticate method."); } return errors; }
ValidateUtils { @NonNull static List<String> validatePromptParams(@NonNull Mode mode, @NonNull Goldfinger.PromptParams params) { List<String> errors = new ArrayList<>(); if (!(params.dialogOwner() instanceof Fragment) && !(params.dialogOwner() instanceof FragmentActivity)) { errors.add("DialogOwner must be of instance Fragment or FragmentActivity"); } if (StringUtils.isBlankOrNull(params.title())) { errors.add("Title is required!"); } if (!params.deviceCredentialsAllowed() && StringUtils.isBlankOrNull(params.negativeButtonText())) { errors.add("NegativeButtonText is required!"); } if (params.deviceCredentialsAllowed() && mode != Mode.AUTHENTICATION) { errors.add("DeviceCredentials are allowed only for Goldfinger#authenticate method."); } return errors; } }
ValidateUtils { @NonNull static List<String> validatePromptParams(@NonNull Mode mode, @NonNull Goldfinger.PromptParams params) { List<String> errors = new ArrayList<>(); if (!(params.dialogOwner() instanceof Fragment) && !(params.dialogOwner() instanceof FragmentActivity)) { errors.add("DialogOwner must be of instance Fragment or FragmentActivity"); } if (StringUtils.isBlankOrNull(params.title())) { errors.add("Title is required!"); } if (!params.deviceCredentialsAllowed() && StringUtils.isBlankOrNull(params.negativeButtonText())) { errors.add("NegativeButtonText is required!"); } if (params.deviceCredentialsAllowed() && mode != Mode.AUTHENTICATION) { errors.add("DeviceCredentials are allowed only for Goldfinger#authenticate method."); } return errors; } private  ValidateUtils(); }
ValidateUtils { @NonNull static List<String> validatePromptParams(@NonNull Mode mode, @NonNull Goldfinger.PromptParams params) { List<String> errors = new ArrayList<>(); if (!(params.dialogOwner() instanceof Fragment) && !(params.dialogOwner() instanceof FragmentActivity)) { errors.add("DialogOwner must be of instance Fragment or FragmentActivity"); } if (StringUtils.isBlankOrNull(params.title())) { errors.add("Title is required!"); } if (!params.deviceCredentialsAllowed() && StringUtils.isBlankOrNull(params.negativeButtonText())) { errors.add("NegativeButtonText is required!"); } if (params.deviceCredentialsAllowed() && mode != Mode.AUTHENTICATION) { errors.add("DeviceCredentials are allowed only for Goldfinger#authenticate method."); } return errors; } private  ValidateUtils();  }
ValidateUtils { @NonNull static List<String> validatePromptParams(@NonNull Mode mode, @NonNull Goldfinger.PromptParams params) { List<String> errors = new ArrayList<>(); if (!(params.dialogOwner() instanceof Fragment) && !(params.dialogOwner() instanceof FragmentActivity)) { errors.add("DialogOwner must be of instance Fragment or FragmentActivity"); } if (StringUtils.isBlankOrNull(params.title())) { errors.add("Title is required!"); } if (!params.deviceCredentialsAllowed() && StringUtils.isBlankOrNull(params.negativeButtonText())) { errors.add("NegativeButtonText is required!"); } if (params.deviceCredentialsAllowed() && mode != Mode.AUTHENTICATION) { errors.add("DeviceCredentials are allowed only for Goldfinger#authenticate method."); } return errors; } private  ValidateUtils();   }