public static TypeAdapter on(Fixture fixture, Method method) { return on(fixture, method, false); }
public static TypeAdapter on(Fixture fixture, Method method) { return on(fixture, method, false); }
public static TypeAdapter on(Fixture fixture, Method method, boolean isRegex) { TypeAdapter a = on(fixture, method.getReturnType()); a.target = fixture; a.method = method; a.isRegex = isRegex; return a; }
public static TypeAdapter on(Fixture fixture, Method method, boolean isRegex) { TypeAdapter a = on(fixture, method.getReturnType()); a.target = fixture; a.method = method; a.isRegex = isRegex; return a; }
public static TypeAdapter on(Fixture fixture, Field field) { TypeAdapter a = on(fixture, field.getType()); a.target = fixture; a.field = field; return a; }
public static TypeAdapter on(Fixture fixture, Method method) { TypeAdapter a = on(fixture, method.getReturnType()); a.target = fixture; a.method = method; return a; }
public static TypeAdapter on(Fixture fixture, Field field) { TypeAdapter a = on(fixture, field.getType()); a.target = fixture; a.field = field; a.field.setAccessible(true); return a; }
public static TypeAdapter on(Fixture fixture, Field field) { TypeAdapter a = on(fixture, field.getType()); a.target = fixture; a.field = field; a.field.setAccessible(true); return a; }
private TypeAdapter getTypeAdapter(Method checkMethod, Class<?> returnType) { try { return(TypeAdapter.on(actor, checkMethod)); } catch (Throwable e) { // NOSONAR throw new FitFailureException("Can not parse return type: " + returnType.getName()); } }
private TypeAdapter getTypeAdapter(Method checkMethod, Class<?> returnType) { try { return(TypeAdapter.on(actor, checkMethod)); } catch (Throwable e) { // NOSONAR throw new FitFailureException("Can not parse return type: " + returnType.getName()); } }
private Object adaptArgumentToType(Class<?> parameterType, String argument) throws Exception { Object arg; try { arg = TypeAdapter.on(actor, parameterType).parse(argument); } catch (NumberFormatException e) { throw new CouldNotParseFitFailureException(argument, parameterType.getName()); } return arg; }
private static TypeAdapter makeAdapterForMethod(String name, Fixture fixture, Matcher matcher, boolean isRegex) { Method method = getMethod(name, fixture, matcher); if (method == null) { throw new NoSuchMethodFitFailureException(name); } return TypeAdapter.on(fixture, method, isRegex); }
private Object adaptArgumentToType(Class<?> parameterType, String argument) throws Exception { Object arg; try { arg = TypeAdapter.on(actor, parameterType).parse(argument); } catch (NumberFormatException e) { throw new CouldNotParseFitFailureException(argument, parameterType.getName()); } return arg; }
protected TypeAdapter bindMethod (String name) throws Exception { return TypeAdapter.on(this, getTargetClass().getMethod(camel(name))); }
protected TypeAdapter bindField (String name) throws Exception { return TypeAdapter.on(this, getTargetClass().getField(camel(name))); }
private static TypeAdapter makeAdapterForMethod(String name, Fixture fixture, Matcher matcher, boolean isRegex) { Method method = getMethod(name, fixture, matcher); if (method == null) { throw new NoSuchMethodFitFailureException(name); } return TypeAdapter.on(fixture, method, isRegex); }
public void enter() throws Exception { Method method = method(1); Class<?> type = method.getParameterTypes()[0]; String text = cells.more.more.text(); Object args[] = { TypeAdapter.on(actor, type).parse(text) }; method.invoke(actor, args); }
public void check() throws Exception { TypeAdapter adapter = TypeAdapter.on(actor, method(0)); check(cells.more.more, adapter); }
private static TypeAdapter makeAdapterForField(String name, Fixture fixture) { Field field = null; if (GracefulNamer.isGracefulName(name)) { String simpleName = GracefulNamer.disgrace(name).toLowerCase(); field = findField(fixture, simpleName); } else { Matcher matcher = fieldPattern.matcher(name); matcher.find(); String fieldName = matcher.group(1); Class<?> clazz = fixture.getTargetClass(); try { field = clazz.getField(fieldName); } catch (NoSuchFieldException e) { try { field = getField(clazz, fieldName); } catch (NoSuchFieldException e2) { } } } if (field == null) throw new NoSuchFieldFitFailureException(name); return TypeAdapter.on(fixture, field); }
private static TypeAdapter makeAdapterForField(String name, Fixture fixture) { Field field = null; if (GracefulNamer.isGracefulName(name)) { String simpleName = GracefulNamer.disgrace(name).toLowerCase(); field = findField(fixture, simpleName); } else { Matcher matcher = fieldPattern.matcher(name); matcher.find(); String fieldName = matcher.group(1); Class<?> clazz = fixture.getTargetClass(); try { field = clazz.getField(fieldName); } catch (NoSuchFieldException e) { try { field = getField(clazz, fieldName); } catch (NoSuchFieldException e2) { } } } if (field == null) throw new NoSuchFieldFitFailureException(name); return TypeAdapter.on(fixture, field); }