@Test
public void testDecisionGuardParameterHandling() throws Exception {

    PolicyParameters parameters = createParametersObject();
    parameters.setPolicyClass(PolicyClass.Decision);
    PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper();
    assertThatThrownBy(() -> wrapper.populateRequestParameters(parameters))
                    .isInstanceOf(NullPointerException.class);
    Map<AttributeType, Map<String, String>> attributes = new LinkedHashMap<>();
    parameters.setAttributes(attributes);
    assertThatThrownBy(() -> wrapper.populateRequestParameters(parameters))
                    .isInstanceOf(NullPointerException.class);
    parameters.setRuleProvider(RuleProvider.GUARD_BL_YAML);
    PolicyRestAdapter adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("GUARD_BL_YAML", adapter.getRuleProvider());
    parameters.setRuleProvider(RuleProvider.GUARD_MIN_MAX);
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("GUARD_MIN_MAX", adapter.getRuleProvider());
    parameters.setRuleProvider(RuleProvider.GUARD_YAML);
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("GUARD_YAML", adapter.getRuleProvider());
    Map<String, String> matchingMap = new LinkedHashMap<>();
    matchingMap.put("actor", "Actor");
    matchingMap.put("recipe", "Recipe");
    matchingMap.put("guardActiveStart", "GuardActiveStart");
    matchingMap.put("guardActiveEnd", "GuardActiveEnd");
    matchingMap.put("limit", "Limit");
    matchingMap.put("timeWindow", "Window");
    matchingMap.put("timeUnits", "Units");
    attributes.put(AttributeType.MATCHING, matchingMap);
    parameters.setAttributes(attributes);
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("Actor", adapter.getYamlparams().getActor());
    assertEquals("Recipe", adapter.getYamlparams().getRecipe());
    assertEquals("GuardActiveStart", adapter.getYamlparams().getGuardActiveStart());
    assertEquals("GuardActiveEnd", adapter.getYamlparams().getGuardActiveEnd());
    assertEquals("Limit", adapter.getYamlparams().getLimit());
    assertEquals("Window", adapter.getYamlparams().getTimeWindow());
    assertEquals("Units", adapter.getYamlparams().getTimeUnits());
    parameters.setRuleProvider(RuleProvider.GUARD_MIN_MAX);
    matchingMap.put("min", "TheMin");
    matchingMap.put("max", "TheMax");
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("TheMin", adapter.getYamlparams().getMin());
    assertEquals("TheMax", adapter.getYamlparams().getMax());
    parameters.setRuleProvider(RuleProvider.GUARD_BL_YAML);
    adapter = wrapper.populateRequestParameters((parameters));
    assertTrue(adapter.getYamlparams().getBlackList().isEmpty());
    matchingMap.put("blackList", "Bad0,Bad1");
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("Bad0", adapter.getYamlparams().getBlackList().get(0));
    assertEquals("Bad1", adapter.getYamlparams().getBlackList().get(1));
    parameters.setRuleProvider(RuleProvider.AAF);
    adapter = wrapper.populateRequestParameters((parameters));
    assertNull(adapter.getYamlparams());
}