001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.test.context.assertj; 018 019import java.util.function.Supplier; 020 021import org.springframework.boot.web.reactive.context.ConfigurableReactiveWebApplicationContext; 022import org.springframework.boot.web.reactive.context.ReactiveWebApplicationContext; 023 024/** 025 * A {@link ReactiveWebApplicationContext} that additionally supports AssertJ style 026 * assertions. Can be used to decorate an existing reactive web application context or an 027 * application context that failed to start. 028 * <p> 029 * See {@link ApplicationContextAssertProvider} for more details. 030 * 031 * @author Phillip Webb 032 * @since 2.0.0 033 * @see ReactiveWebApplicationContext 034 * @see ReactiveWebApplicationContext 035 */ 036public interface AssertableReactiveWebApplicationContext extends 037 ApplicationContextAssertProvider<ConfigurableReactiveWebApplicationContext>, 038 ConfigurableReactiveWebApplicationContext { 039 040 /** 041 * Factory method to create a new {@link AssertableReactiveWebApplicationContext} 042 * instance. 043 * @param contextSupplier a supplier that will either return a fully configured 044 * {@link ConfigurableReactiveWebApplicationContext} or throw an exception if the 045 * context fails to start. 046 * @return a {@link AssertableReactiveWebApplicationContext} instance 047 */ 048 static AssertableReactiveWebApplicationContext get( 049 Supplier<? extends ConfigurableReactiveWebApplicationContext> contextSupplier) { 050 return ApplicationContextAssertProvider.get( 051 AssertableReactiveWebApplicationContext.class, 052 ConfigurableReactiveWebApplicationContext.class, contextSupplier); 053 } 054 055}