From ced78faf6bcef79c8db18d68e2ff1b7e2efa750b Mon Sep 17 00:00:00 2001 From: Artur Kmieckowiak Date: Sat, 11 Jan 2020 09:46:21 +0100 Subject: [PATCH] Added spock framework --- build.gradle | 17 ++++++++++++++++- .../study/bookapi/BookapiApplicationTests.java | 0 .../com/fnecan/study/bookapi/ExampleTest.groovy | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) rename src/test/{java => groovy}/com/fnecan/study/bookapi/BookapiApplicationTests.java (100%) create mode 100644 src/test/groovy/com/fnecan/study/bookapi/ExampleTest.groovy diff --git a/build.gradle b/build.gradle index 59f5f2c..0b4ed94 100644 --- a/build.gradle +++ b/build.gradle @@ -8,10 +8,17 @@ group = 'com.fnecan.study' version = '0.0.1-SNAPSHOT' sourceCompatibility = '1.8' + repositories { mavenCentral() + jcenter() } +apply plugin: 'groovy' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' implementation 'org.springframework.boot:spring-boot-starter-security' @@ -20,8 +27,16 @@ dependencies { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } testImplementation 'org.springframework.security:spring-security-test' + testCompile ( + 'org.codehaus.groovy:groovy-all:2.4.4', + 'org.spockframework:spock-core:1.0-groovy-2.4' + ) + + testRuntime( + 'com.athaydes:spock-reports:1.2.7' + ) } test { useJUnitPlatform() -} +} \ No newline at end of file diff --git a/src/test/java/com/fnecan/study/bookapi/BookapiApplicationTests.java b/src/test/groovy/com/fnecan/study/bookapi/BookapiApplicationTests.java similarity index 100% rename from src/test/java/com/fnecan/study/bookapi/BookapiApplicationTests.java rename to src/test/groovy/com/fnecan/study/bookapi/BookapiApplicationTests.java diff --git a/src/test/groovy/com/fnecan/study/bookapi/ExampleTest.groovy b/src/test/groovy/com/fnecan/study/bookapi/ExampleTest.groovy new file mode 100644 index 0000000..67bfc79 --- /dev/null +++ b/src/test/groovy/com/fnecan/study/bookapi/ExampleTest.groovy @@ -0,0 +1,15 @@ +package com.fnecan.study.bookapi + +import spock.lang.Specification + +class ExampleTest extends Specification { + + def "It should run the application" () { + when: + def a = 1; + + then: + a == 1 + } + +}