@Override public Object getTestInstance() { return testContext.getTestInstance(); }
@Override public Object getTestInstance() { return testContext.getTestInstance(); }
@Override public Object getTestInstance() { return testContext.getTestInstance(); }
@Override public Object getTestInstance() { return testContext.getTestInstance(); }
try { m.setAccessible(true); m.invoke(testContext.getTestInstance(), configuration); } catch (Exception e) { checkState(false,
public EmbeddedServletContainerFactory getEmbeddedServletContainerFactory( @SuperCall Callable<EmbeddedServletContainerFactory> zuper, @This Object object) throws Exception { EmbeddedServletContainerFactory containerFactory = zuper.call(); ConfigurableEmbeddedServletContainer configurableServletContainer = (ConfigurableEmbeddedServletContainer) containerFactory; configurableServletContainer.setPort(0); SpringBootDescriptor descriptor = getDescriptor(object); descriptor.setContainerFactory(containerFactory); descriptor.setConfigurableServletContainer(configurableServletContainer); TestContext testContext = descriptor.getTestContext(); testContext.getConfigMethod(ConfigurableEmbeddedServletContainer.class) .map(m -> m.getMethod()) .ifPresent(m -> { AccessController.doPrivileged((PrivilegedAction<Object>) () -> { try { m.setAccessible(true); m.invoke(testContext.getTestInstance(), configurableServletContainer); } catch (Exception e) { checkState(false, "Call to config method '%s' in test class '%s' failed.", m.getName(), testContext.getTestClassName()); throw Throwables.propagate(e); } return null; }); }); return containerFactory; }
public ServerContext getServerContext(TestContext testContext, String methodName) { Object testInstance = testContext.getTestInstance(); return testContext.getAnnotation(App.class).map(p -> { Class<?> appType = p.value();