package com.iovation.launchkey.sdk.integration.cucumber.converters;

import com.iovation.launchkey.sdk.domain.service.AuthMethod;
import io.cucumber.datatable.DataTable;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class MethodsListConverter {
    public static List<AuthMethod> fromDataTable(DataTable dataTable) {

        List<AuthMethod> methods = new ArrayList<>();

        List<Map<String, String>> rows = dataTable.asMaps(String.class, String.class);
        for (Map<String, String> map : rows) {
            String set = map.get("Set").toLowerCase();
            String active = map.get("Active").toLowerCase();
            String allowed = map.get("Allowed").toLowerCase();
            String supported = map.get("Supported").toLowerCase();
            String userRequired = map.get("User Required").toLowerCase();
            String passed = map.get("Passed").toLowerCase();
            String error = map.get("Error").toLowerCase();
            methods.add(new AuthMethod(
                    AuthMethod.Type.fromString(map.get("Method")),
                    set.isEmpty() ? null : Boolean.valueOf(set),
                    active.isEmpty() ? null : Boolean.valueOf(active),
                    allowed.isEmpty() ? null : Boolean.valueOf(allowed),
                    supported.isEmpty() ? null : Boolean.valueOf(supported),
                    userRequired.isEmpty() ? null : Boolean.valueOf(userRequired),
                    passed.isEmpty() ? null : Boolean.valueOf(passed),
                    error.isEmpty() ? null : Boolean.valueOf(error)
            ));
        }

        return methods;
    }
}

@@ -560,16 +560,46 @@
 ng set =
+ map.get(%22Set%22) == null ? %22%22 :
  map.get
@@ -648,16 +648,49 @@
 active =
+ map.get(%22Active%22) == null ? %22%22 :
  map.get
@@ -739,24 +739,58 @@
 ng allowed =
+ map.get(%22Allowed%22) == null ? %22%22 :
  map.get(%22Al
@@ -838,24 +838,60 @@
  supported =
+ map.get(%22Supported%22) == null ? %22%22 :
  map.get(%22Su
@@ -944,24 +944,64 @@
 erRequired =
+ map.get(%22User Required%22) == null ? %22%22 :
  map.get(%22Us
@@ -1052,24 +1052,57 @@
 ing passed =
+ map.get(%22Passed%22) == null ? %22%22 :
  map.get(%22Pa
@@ -1149,16 +1149,48 @@
  error =
+ map.get(%22Error%22) == null ? %22%22 :
  map.get

Fix broken table based test related to Cucumber update