@SuppressWarnings("unchecked")
@Test
public void testActionParameterHandling() throws Exception {

    PolicyParameters parameters = createParametersObject();
    parameters.setPolicyClass(PolicyClass.Action);
    PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper();
    PolicyRestAdapter adapter = wrapper.populateRequestParameters((parameters));
    assertTrue(adapter.getRuleAlgorithmschoices().isEmpty());
    List<String> dynamicRuleAlgorithmLabels = new ArrayList<>();
    parameters.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
    adapter = wrapper.populateRequestParameters((parameters));
    assertTrue(adapter.getRuleAlgorithmschoices().isEmpty());
    dynamicRuleAlgorithmLabels.add("Label0");
    List<String> dynamicRuleAlgorithmFunctions = new ArrayList<>();
    dynamicRuleAlgorithmFunctions.add("FirstAlgorithmFunction");
    parameters.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions);
    List<String> dynamicRuleAlgorithmField1 = new ArrayList<>();
    dynamicRuleAlgorithmField1.add("FirstAlgorithmFunctionField1");
    parameters.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
    List<String> dynamicRuleAlgorithmField2 = new ArrayList<>();
    dynamicRuleAlgorithmField2.add("FirstAlgorithmFunctionField2");
    parameters.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
    parameters.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals(1, adapter.getRuleAlgorithmschoices().size());
    assertEquals("Label0", ((LinkedHashMap<String, String>) adapter.getRuleAlgorithmschoices().get(0)).get("id"));
    Map<String, String> matchingMap = new LinkedHashMap<>();
    matchingMap.put("AKey", "AValue");
    Map<AttributeType, Map<String, String>> attributes = new LinkedHashMap<>();
    attributes.put(AttributeType.MATCHING, matchingMap);
    parameters.setAttributes(attributes);
    adapter = wrapper.populateRequestParameters((parameters));
    assertEquals("AKey", ((LinkedHashMap<String, String>) adapter.getAttributes().get(0)).get("key"));
}