package hu.pazsitz.pacuse.tests.cucumber.featuretables;

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

/**
 * FieldActionResult.java
 *
 * @author Zoltan Pazsit <pazsitz@pazsitz.hu>
 * @copyright Copyright (c) 2014, Zoltan Pazsit
 */
public class FieldActionResult {
	private final int tableFieldNumber;
	private final List<String> fieldSuccess;
	private final List<String> fieldNonDeterined;
	private final Map<String, String> fieldFailed;
	
	public FieldActionResult(int tableFieldNumber, List<String> fieldSuccess, List<String> fieldNonDeterined, Map<String, String> fieldFailed) {
		this.tableFieldNumber = tableFieldNumber;
		this.fieldSuccess = fieldSuccess;
		this.fieldNonDeterined = fieldNonDeterined;
		this.fieldFailed = fieldFailed;
	}
	
	/**
	 * The last procedure was successful and all the table fields have been evaluated already
	 * @return boolean
	 */
	public boolean fullSuccess() {
		return success() && fieldNonDeterined.size() == 0;
	}
	
	/**
	 * The last procedure was successful
	 * @return boolean
	 */
	public boolean success() {
		return fieldFailed.size() == 0;
	}
	
	/**
	 * Has the last procedure contained failures
	 * @return
	 */
	public boolean hasFailed() {
		return fieldFailed.size() > 0;
	}
	
	/**
	 * Has the table non-determined/evaluated field
	 * @return
	 */
	public boolean hasNonDeterined() {
		return fieldNonDeterined.size() > 0;
	}
	
	public Map<String, String> getFailedFields() {
		return fieldFailed;
	}
	
	public List<String> getNonDeterminedFields() {
		return fieldNonDeterined;
	}
}

@@ -50,16 +50,42 @@
 ables;%0A%0A
+import java.util.HashMap;%0A
 import j
@@ -99,16 +99,16 @@
 l.List;%0A
-
 import j
@@ -865,16 +865,86 @@
 already%0A
+%09 * use FieldActionResult.getNonSucceedFields() for assertion message%0A
 %09 * @ret
@@ -1512,32 +1512,32 @@
 ailedFields() %7B%0A
-
 %09%09return fieldFa
@@ -1543,24 +1543,387 @@
 ailed;%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Gets the sum of failed and nonDetermined fields%0A%09 * For assertion debug message%0A%09 * @return Map%3CString, String%3E%0A%09 */%0A%09public Map%3CString, String%3E getNonSucceedFields() %7B%0A%09%09Map%3CString, String%3E map = new HashMap%3CString, String%3E();%0A%09%09map.putAll(fieldFailed);%0A%09%09for (String item : fieldNonDeterined) %7B map.put(item, %22Non Determined%22); %7D%0A%09%09%0A%09%09return map;%0A%09%7D%0A%09%0A
 %09public List

add method for assertion debug message