com.exactpro.sf.actions.BugsUtils Maven / Gradle / Ivy
/******************************************************************************
* Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.exactpro.sf.actions;
import com.exactpro.sf.aml.Description;
import com.exactpro.sf.comparison.Convention;
import com.exactpro.sf.configuration.ResourceAliases;
import com.exactpro.sf.scriptrunner.AbstractCaller;
import com.exactpro.sf.scriptrunner.utilitymanager.UtilityMethod;
import com.exactpro.sf.util.BugsCheckerBuilder;
import com.exactpro.sf.util.BugsListCheckerBuilder;
/**
* @author sergey.vasiliev
*
*/
@MatrixUtils
@ResourceAliases("BugsUtils")
public class BugsUtils extends AbstractCaller {
@UtilityMethod
@Description("This method compares the actual value against the expected value and also takes into account
"
+ "the values of the known bugs which can be added by calling the Bug(description, value) / BugEmpty(description) method after calling the function.
"
+ "Considering the above said, the final syntax is:
"
+ "#{Expected(value)}[.Bug(String description, Object alternativeValue) ...][.Actual(x)].
"
+ "If one of the alternative values must be empty, then use:
"
+ "#{Expected(value)}[.BugEmpty(String description) ...][.Actual(x)].
" )
public BugsCheckerBuilder Expected(Object originValue) {
return new BugsCheckerBuilder(originValue);
}
@UtilityMethod
@Description("This method compares the size of actual values against the expected size of values and also takes into account
"
+ "the list value sizes of the known bugs which can be added by calling the Bug(description, [value]) / BugEmpty(description) / BugAny(description) method after calling the function.
"
+ "User should specify a list of values with unique size in every node.
"
+ "Expected or first matching combination by size with the actual value will be applied for deep check.
"
+ "Considering the above said, the final syntax is:
"
+ "#{ExpectedList([value])}[.Bug(String description, Object [value, value]) ...].
"
+ "If one of the alternative value lists must be empty, then use:
"
+ "#{ExpectedList(value)}[.BugEmpty(String description) ...].
" )
public BugsListCheckerBuilder ExpectedList(Object originValue) {
return new BugsListCheckerBuilder(originValue);
}
@UtilityMethod
@Description("This method compares the actual value against the expected empty value and also takes into account
"
+ "the values of the known bugs which can be added by calling the Bug(description, value) / BugAny(description) method after calling the function.
"
+ "Considering the above said, the final syntax is:
"
+ "#{ExpectedEmpty()}[.Bug(String description, Object alternativeValue) ...][.Actual(x)].
"
+ "If the alternative value can’t be empty, then use:
"
+ "#{ExpectedEmpty(value)}.BugAny(String description)[.Actual(x)].
")
public BugsCheckerBuilder ExpectedEmpty() {
return new BugsCheckerBuilder(Convention.CONV_MISSED_OBJECT);
}
@UtilityMethod
@Description("This method compares the size of actual values against the expected empty size of values and also takes into account
"
+ "the list value sizes of the known bugs which can be added by calling the Bug(description, value) / BugEmpty(description) method after calling the function.
"
+ "User should specify a list of values with unique size in every node.
"
+ "Expected or first matching combination by size with the actual value will be applied for deep check.
"
+ "Considering the above said, the final syntax is:
"
+ "#{ExpectedEmptyList()}[.Bug(String description, Object alternativeValue) ...][.Actual(x)].
"
+ "If the alternative value list can’t be empty, then use:
"
+ "#{ExpectedEmptyList(value)}.BugAny(String description)[.Actual(x)].
")
public BugsListCheckerBuilder ExpectedEmptyList() {
return new BugsListCheckerBuilder(Convention.CONV_MISSED_OBJECT);
}
@UtilityMethod
@Description("This method compares the actual value against the expected not empty value and also takes into account
"
+ "the values of the known bugs which can be added by calling the BugEmpty(description) method after calling the function.
"
+ "Considering the above said, the final syntax is:
"
+ "#{ExpectedAny()}.BugEmpty(String description)[.Actual(x)].
")
public BugsCheckerBuilder ExpectedAny() {
return new BugsCheckerBuilder(Convention.CONV_PRESENT_OBJECT);
}
@UtilityMethod
@Description("This method compares the size of actual values against the expected not empty value list and also takes into account
"
+ "the list value sizes of the known bugs which can be added by calling the BugEmpty(description) method after calling the function.
"
+ "User should specify a list of values with unique size in every node.
"
+ "Considering the above said, the final syntax is:
"
+ "#{ExpectedAnyList()}.BugEmpty(String description)[.Actual(x)].
")
public BugsListCheckerBuilder ExpectedAnyList() {
return new BugsListCheckerBuilder(Convention.CONV_PRESENT_OBJECT);
}
}