@RunWith(SpringRunner.class) @SpringBootTest public class DemoApplicationTests { @Test public void contextLoads() { } }
@RunWith(SpringRunner.class) @SpringBootTest public class JibApplicationTests { @Test public void contextLoads() { } }
/** * @author Gary Russell * @since 4.2 */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = Application.class) public class ApplicationTests { @Test public void contextLoads() { } }
/** * @author Artem Bilan * @since 3.0 */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) public class ApplicationTests { @Test public void contextLoads() { } }
@RunWith(SpringRunner.class) @SpringBootTest public class DynamicTcpClientApplicationTests { @Test public void contextLoads() { } }
/** * @author Artem Bilan * @since 3.0 */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class) public class ApplicationTests { @Test public void testWebSockets() throws InterruptedException { } }
@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class) public class ApplicationTests { @Test public void contextLoads() { } }
@RunWith(SpringRunner.class) @SpringBootTest public class DemoApplicationTests { @Test public void contextLoads() { } }
@RunWith(SpringRunner.class) @SpringBootTest public class DemoApplicationTests { @Test public void contextLoads() { } }
/** * Created by alexf on 28-Jan-16. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = {DemoApp.class },webEnvironment = NONE ,properties = {"grpc.enabled=false","grpc.inProcessServerName=testServer"} ) public class DisabledGrpcServerTest extends GrpcServerTestBase { @Test public void disabledServerTest() throws Throwable { assertNull(grpcServerRunner); assertNotNull(grpcInprocessServerRunner); } }
/** * Created by alexf on 28-Jan-16. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = {DemoApp.class },webEnvironment = NONE ,properties = {"grpc.enabled=false","grpc.inProcessServerName=testServer"} ) public class DisabledGrpcServerTest extends GrpcServerTestBase { @Test public void disabledServerTest() throws Throwable { assertNull(grpcServerRunner); assertNotNull(grpcInprocessServerRunner); } }
@RunWith(SpringRunner.class) @SpringBootTest(classes = Config.class) public static class DisabledByDefault { @Autowired(required = false) private DiscoveryClientRouteDefinitionLocator locator; @Test public void routeLocatorBeanMissing() { assertThat(locator) .as("DiscoveryClientRouteDefinitionLocator exists") .isNull(); } }
/** * @author Stephane Nicoll * @author Dave Syer */ @SpringBootTest(classes = Config.class, webEnvironment = WebEnvironment.RANDOM_PORT) public abstract class AbstractFullStackInitializrIntegrationTests extends AbstractInitializrIntegrationTests { @LocalServerPort protected int port; protected String host = "localhost"; @Override protected String createUrl(String context) { return "http://" + this.host + ":" + this.port + (context.startsWith("/") ? context : "/" + context); } }
@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.NONE) public class HelloApplicationIntegrationTest { private final HttpClient client = HttpClient.of("http://localhost:8080"); @Test public void success() { final AggregatedHttpMessage response = client.get("/hello/Spring").aggregate().join(); assertThat(response.status()).isEqualTo(HttpStatus.OK); assertThat(response.content().toStringUtf8()) .isEqualTo("Hello, Spring! This message is from Armeria annotated service!"); } @Test public void failure() { final AggregatedHttpMessage response = client.get("/hello/a").aggregate().join(); assertThat(response.status()).isEqualTo(HttpStatus.BAD_REQUEST); assertThatJson(response.content().toStringUtf8()) .node("message") .isEqualTo("hello.name: name should have between 3 and 10 characters"); } }
/** * @author Rob Winch */ @SpringBootTest @AutoConfigureMockMvc @RunWith(SpringRunner.class) public class OAuth2WebClientApplicationTests { @Autowired private MockMvc mockMvc; @Test public void annotationExplicitWhenNotAuthenticatedThenLoginRequested() throws Exception { this.mockMvc.perform(get("/annotation/explicit")) .andExpect(status().is3xxRedirection()); } }
/** * @author Rob Winch */ @SpringBootTest @AutoConfigureWebTestClient @RunWith(SpringRunner.class) public class OAuth2WebClientWebFluxApplicationTests { @Autowired private WebTestClient client; @Test public void annotationExplicitWhenNotAuthenticatedThenLoginRequested() { this.client.get().uri("/annotation/explicit") .exchange() .expectStatus().is3xxRedirection(); } }
/** * @author Filippo Balicchia * @since 4.2 */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = Application.class) public class ApplicationTests { @ClassRule public static SplunkWatcher splunkWatcher = new SplunkWatcher(); @Test public void contextLoads() { } }
@RunWith(SpringRunner.class) @SpringBootTest(classes = {DemoApp.class}, webEnvironment = NONE) public class DefaultGrpcPortTest extends GrpcServerTestBase { @LocalRunningGrpcPort int runningPort; @Override protected int getPort() { return runningPort; } @Override protected void beforeGreeting() { Assert.assertEquals(0, gRpcServerProperties.getPort()); Assert.assertEquals(GRpcServerProperties.DEFAULT_GRPC_PORT, runningPort); } }
@RunWith(SpringRunner.class) @SpringBootTest(classes = {DemoApp.class}, webEnvironment = NONE) public class DefaultGrpcPortTest extends GrpcServerTestBase { @LocalRunningGrpcPort int runningPort; @Override protected int getPort() { return runningPort; } @Override protected void beforeGreeting() { Assert.assertEquals(0, gRpcServerProperties.getPort()); Assert.assertEquals(GRpcServerProperties.DEFAULT_GRPC_PORT, runningPort); } }
@RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = RANDOM_PORT) @DirtiesContext @ActiveProfiles("multi-cert-ssl") public class MultiCertSSLTests extends SingleCertSSLTests { }