001package com.lucidtech.puttingalltogether.samples;
002
003import com.lucidtech.puttingalltogether.controller.GreetingController;
004import org.junit.jupiter.api.Test;
005import org.springframework.beans.factory.annotation.Autowired;
006import org.springframework.boot.test.context.SpringBootTest;
007
008import static org.assertj.core.api.Assertions.assertThat;
009
010@SpringBootTest
011//The @SpringBootTest annotation tells Spring Boot to look for a main
012// configuration class (one with @SpringBootApplication, for instance) and use that to start a Spring application context.
013class StartFullSpringContextWithoutServerIT {
014    @Autowired
015    private GreetingController controller;
016
017    @Test
018    //The first thing we can do is write a simple sanity check test that will fail if the application context cannot start.
019    public void contextLoads() {
020    }
021
022    @Test
023    //To convince ourselves that the context is creating our controller, we could add an assertion
024    public void controllerIsNotNull() {
025        assertThat(controller).isNotNull();
026    }
027}