use of com.axway.ats.core.reflect.TypeComparisonRule in project ats-framework by Axway.
the class Test_StringToEnumRule method isCompatibleNegativeArgisArrayParamIsNot.
@Test(expected = NoSuchMethodException.class)
public void isCompatibleNegativeArgisArrayParamIsNot() throws NoSuchMethodException, AmbiguousMethodException {
List<TypeComparisonRule> typeComparisonRules = new ArrayList<TypeComparisonRule>();
typeComparisonRules.add(new StringToEnumRule());
MethodFinder methodFinder = new MethodFinder("methods", Arrays.asList(ActionClassEnumArguments.class.getDeclaredMethods()), typeComparisonRules);
//String argument
assertNotNull(methodFinder.findMethod(new Class<?>[] { (new int[] {}).getClass() }));
}
use of com.axway.ats.core.reflect.TypeComparisonRule in project ats-framework by Axway.
the class Test_MethodFinder method findMethodConstructorMethodListCustomRulesPositive.
@Test
public void findMethodConstructorMethodListCustomRulesPositive() throws NoSuchMethodException, AmbiguousMethodException {
List<TypeComparisonRule> typeComparisonRules = new ArrayList<TypeComparisonRule>();
typeComparisonRules.add(new CustomTypeComparisonRule());
MethodFinder methodFinder = new MethodFinder("methods", Arrays.asList(MethodFinderTester.class.getDeclaredMethods()), typeComparisonRules);
//one argument - this argument will be evaulated as String in our custom rule
assertNotNull(methodFinder.findMethod(new Class<?>[] { Test_MethodFinder.class }));
}
use of com.axway.ats.core.reflect.TypeComparisonRule in project ats-framework by Axway.
the class Test_StringToEnumRule method isCompatibleNegativeWrongArgType.
@Test(expected = NoSuchMethodException.class)
public void isCompatibleNegativeWrongArgType() throws NoSuchMethodException, AmbiguousMethodException {
List<TypeComparisonRule> typeComparisonRules = new ArrayList<TypeComparisonRule>();
typeComparisonRules.add(new StringToEnumRule());
MethodFinder methodFinder = new MethodFinder("methods", Arrays.asList(ActionClassEnumArguments.class.getDeclaredMethods()), typeComparisonRules);
//String argument
assertNotNull(methodFinder.findMethod(new Class<?>[] { Integer.class }));
}
use of com.axway.ats.core.reflect.TypeComparisonRule in project ats-framework by Axway.
the class Test_StringToEnumRule method isCompatiblePositive.
@Test
public void isCompatiblePositive() throws NoSuchMethodException, AmbiguousMethodException {
List<TypeComparisonRule> typeComparisonRules = new ArrayList<TypeComparisonRule>();
typeComparisonRules.add(new StringToEnumRule());
MethodFinder methodFinder = new MethodFinder("methods", Arrays.asList(ActionClassEnumArguments.class.getDeclaredMethods()), typeComparisonRules);
//String argument
assertNotNull(methodFinder.findMethod(new Class<?>[] { String.class }));
//array of Strings argument
assertNotNull(methodFinder.findMethod(new Class<?>[] { (new String[] {}).getClass(), Integer.TYPE }));
}
Aggregations