@RuntimeType public Class<?>[] getServletConfigClasses(@SuperCall Callable<Class<?>[]> zuper, @This Object object) throws Exception { Class<?>[] result = zuper.call(); return TestContextHolder.INSTANCE.query(testContext -> { TestDescriptor testDescriptor = testContext.getTestDescriptor(); Collection<Module> modules = testDescriptor.getModules(); Stream<Class<?>> testModules = modules.stream().map(Module::value); Stream<Class<?>> productionModules = Stream.empty(); if (result != null) { productionModules = Stream.of(result); } return Stream.concat(testModules, productionModules).toArray(Class[]::new); }); }
@Override public MethodDelegationBinder.ParameterBinding<?> bind(AnnotationDescription.Loadable<This> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner, Assigner.Typing typing) { if (target.getType().isPrimitive()) { throw new IllegalStateException(target + " uses a primitive type with a @This annotation"); } else if (target.getType().isArray()) { throw new IllegalStateException(target + " uses an array type with a @This annotation"); } else if (source.isStatic() && !annotation.loadSilent().optional()) { return MethodDelegationBinder.ParameterBinding.Illegal.INSTANCE; } return new MethodDelegationBinder.ParameterBinding.Anonymous(source.isStatic() ? NullConstant.INSTANCE : new StackManipulation.Compound(MethodVariableAccess.loadThis(), assigner.assign(implementationTarget.getInstrumentedType().asGenericType(), target.getType(), typing))); } }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod(@SuperCall Callable<?> zuper, @This(optional = true) Object object) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object, @AllArguments Object[] args) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object, @AllArguments Object[] args) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object, @AllArguments Object[] args) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object, @AllArguments Object[] args) throws Exception { return zuper.call(); }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod( @SuperCall Callable<?> zuper, @This(optional = true) Object object, @AllArguments Object[] args) throws Exception { return zuper.call(); }
public ConfigurableApplicationContext run( @SuperCall Callable<ConfigurableApplicationContext> zuper, @This Object object, @AllArguments Object[] args) throws Exception { AnnotationConfigEmbeddedWebApplicationContext applicationContext = (AnnotationConfigEmbeddedWebApplicationContext) zuper.call(); TestContextHolder.INSTANCE.command(testContext -> { testContext.addProperty(APP, object); if (args.length == 2) { testContext.addProperty(APP_ARGUMENTS, args[1]); } }); return applicationContext; }
@RuntimeType @BindingPriority(Integer.MAX_VALUE) public Object anyMethod(@SuperCall Callable<?> zuper, @Origin Method method, @This(optional = true) Object object) throws Exception { Object result = zuper.call(); if (method.getName().equals("start")) { TestContextHolder.INSTANCE.command(testContext -> { int port = ((Server) object).getPort(); testContext.addProperty(TestContextProperties.APP_PORT, port); testContext.addProperty(TestContextProperties.SERVER, object); URI baseURI = URI.create(format("grpc://localhost:%d", port)); testContext.addProperty(TestContextProperties.SERVER_BASE_URI, baseURI); }); } return result; }
public void refresh( @SuperCall Callable<Void> zuper, @This ConfigurableApplicationContext applicationContext, @AllArguments Object[] args) throws Exception { TestContextHolder.INSTANCE.command(testContext -> {
public ConfigurableListableBeanFactory obtainFreshBeanFactory( @SuperCall Callable<ConfigurableListableBeanFactory> zuper, @This Object applicationContext, @AllArguments Object[] args) throws Exception { DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) zuper.call();