Skip to content

Instantly share code, notes, and snippets.

@thetekst
Created April 19, 2020 10:58
Show Gist options
  • Save thetekst/48b090ce69b990f61c3a1264b68c202b to your computer and use it in GitHub Desktop.
Save thetekst/48b090ce69b990f61c3a1264b68c202b to your computer and use it in GitHub Desktop.
Spring Boot Test. Spock. Check for ApplicationContext
package ru.tkachenko.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author d.tkachenko
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package ru.tkachenko.app
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import spock.lang.Specification
/**
* @author d.tkachenko
*/
@SpringBootTest
class ApplicationTest extends Specification {
@Autowired(required = false)
private Application application
def test() {
expect: "the Application is created"
application
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment