@Before public void before() { AdminFormValues prnfs = new AdminFormValues(); prnfs.add(ImmutableMap.<String, String>builder().put("key", "PRNFS").build()); this.prnfs = new Gson().toJson(prnfs); AdminFormValues prnfb = new AdminFormValues(); prnfb.add(ImmutableMap.<String, String>builder().put("key", "PRNFB").build()); this.prnfb = new Gson().toJson(prnfb); settings = mock(PluginSettings.class); }
public static void injectFormIdentifierIfNotSet(final AdminFormValues config) { final Optional<Map<String, String>> formIdOpt = tryFind(config, predicate(FORM_IDENTIFIER.name())); if (!formIdOpt.isPresent() || formIdOpt.get().get(VALUE).trim().isEmpty()) { final String generatedIdentifier = formIdentifierGnerator(); removeIf(config, predicate(FORM_IDENTIFIER.name())); config.add( new ImmutableMap.Builder<String, String>() .put(NAME, FORM_IDENTIFIER.name()) .put(VALUE, generatedIdentifier) .build()); } }
/** Inject a default name for the trigger. To make the plugin backwards compatible. */ private static AdminFormValues injectConfigurationName(AdminFormValues adminFormValues) { final Optional<Map<String, String>> nameMapOpt = tryFind(adminFormValues, predicate(name.name())); if (nameMapOpt.isPresent()) { return adminFormValues; } adminFormValues.add( ImmutableMap.<String, String>builder() // .put(NAME, name.name()) // .put(VALUE, DEFAULT_NAME) // .build()); return adminFormValues; }