Skip to content

Conversation

@ahmetbardiz
Copy link
Contributor

@ahmetbardiz ahmetbardiz commented Aug 9, 2017

aşağıdaki propertiler kullanılarak yapılan testte bir validationgroup geldiğinde result değişkeni null geldiği için hata aldığından dolayı mevcut döngü değiştirilmiştir.

data11.put("age","1");
data11.put("continent", "asia");
data11.put("username", "semih");
data11.put("category", "3");
public void testGroupOrValidation() {
	Map map = gson.fromJson(readFile("input/group_or_test.json"), Map.class);

	ValidationGroup validationGroup = new ValidationGroup(map);    
        assertTrue(validationGroup.execute(data11));
	assertFalse(validationGroup.execute(data1));
}
//group_or_test.json file
{
  "condition": "OR",
  "rules": [
    {
      "condition": "AND",
      "rules": [
        {
          "id": "age",
          "field": "age",
          "type": "integer",
          "input": "text",
          "operator": "equal",
          "value": "1"
        },
        {
          "id": "continent",
          "field": "continent",
          "type": "string",
          "input": "select",
          "operator": "equal",
          "value": "asia"
        }
      ],
      "not": false
    },
    {
      "condition": "AND",
      "rules": [
        {
          "id": "name",
          "field": "username",
          "type": "string",
          "input": "text",
          "operator": "equal",
          "value": "semih"
        },
        {
          "id": "category",
          "field": "category",
          "type": "integer",
          "input": "checkbox",
          "operator": "in",
          "value": [
            "3"
          ]
        }
      ],
      "not": false
    }
  ],
  "not": false,
  "valid": true
}

@ibrahimAltinoluk ibrahimAltinoluk merged commit 354bd3e into ibrahimAltinoluk:master Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants