From 9fa51611a12909ea14f6e89e5bacbd147bf4315c Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Tue, 23 Feb 2016 21:40:19 +0100 Subject: [PATCH] Added more checks in tests. --- .../accurest/SingleTestGeneratorSpec.groovy | 3 ++- .../accurest/plugin/ScenarioProjectSpec.groovy | 12 ++++++++++-- .../java/com/blogspot/toomuchcoding/MvcTest.java | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 accurest-gradle-plugin/src/test/resources/functionalTest/scenarioProject/fraudDetectionService/src/test/java/com/blogspot/toomuchcoding/MvcTest.java diff --git a/accurest-core/src/test/groovy/io/codearte/accurest/SingleTestGeneratorSpec.groovy b/accurest-core/src/test/groovy/io/codearte/accurest/SingleTestGeneratorSpec.groovy index 7496f83446..d3f37399c2 100644 --- a/accurest-core/src/test/groovy/io/codearte/accurest/SingleTestGeneratorSpec.groovy +++ b/accurest-core/src/test/groovy/io/codearte/accurest/SingleTestGeneratorSpec.groovy @@ -20,7 +20,8 @@ class SingleTestGeneratorSpec extends Specification { static List jUnitClassStrings = ['package test;', 'import com.jayway.jsonpath.DocumentContext;', 'import com.jayway.jsonpath.JsonPath;', 'import org.junit.FixMethodOrder;', 'import org.junit.Ignore;', 'import org.junit.Test;', 'import org.junit.runners.MethodSorters;', 'import static com.blogspot.toomuchcoding.jsonassert.JsonAssertion.assertThatJson;', 'import static com.jayway.restassured.module.mockmvc.RestAssuredMockMvc.*;', - '@FixMethodOrder(MethodSorters.NAME_ASCENDING)', '@Test', '@Ignore'] + '@FixMethodOrder(MethodSorters.NAME_ASCENDING)', '@Test', '@Ignore', 'mport com.jayway.restassured.module.mockmvc.specification.MockMvcRequestSpecification;', + 'import com.jayway.restassured.response.ResponseOptions;', 'import static org.assertj.core.api.Assertions.assertThat;'] static List spockClassStrings = ['package test', 'import com.jayway.jsonpath.DocumentContext', 'import com.jayway.jsonpath.JsonPath', 'import spock.lang.Ignore', 'import spock.lang.Specification', 'import spock.lang.Stepwise', diff --git a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/ScenarioProjectSpec.groovy b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/ScenarioProjectSpec.groovy index ea7d0e27e3..9fafcc39e7 100755 --- a/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/ScenarioProjectSpec.groovy +++ b/accurest-gradle-plugin/src/test/groovy/io/codearte/accurest/plugin/ScenarioProjectSpec.groovy @@ -4,18 +4,26 @@ import nebula.test.IntegrationSpec import spock.lang.Stepwise @Stepwise -class ScenarioProjectSpec extends IntegrationSpec { +class ScenarioProjectSpec extends AccurestIntegrationSpec { void setup() { copyResources("functionalTest/scenarioProject", "") runTasksSuccessfully('clean') //delete accidental output when previously importing SimpleBoot into Idea to tweak it } - def "should pass basic flow"() { + def "should pass basic flow for Spock"() { given: assert fileExists('build.gradle') expect: runTasksSuccessfully('check') } + def "should pass basic flow for JUnit"() { + given: + assert fileExists('build.gradle') + expect: + switchToJunitTestFramework() + runTasksSuccessfully('check') + } + } diff --git a/accurest-gradle-plugin/src/test/resources/functionalTest/scenarioProject/fraudDetectionService/src/test/java/com/blogspot/toomuchcoding/MvcTest.java b/accurest-gradle-plugin/src/test/resources/functionalTest/scenarioProject/fraudDetectionService/src/test/java/com/blogspot/toomuchcoding/MvcTest.java new file mode 100644 index 0000000000..084a65ebf5 --- /dev/null +++ b/accurest-gradle-plugin/src/test/resources/functionalTest/scenarioProject/fraudDetectionService/src/test/java/com/blogspot/toomuchcoding/MvcTest.java @@ -0,0 +1,16 @@ +package com.blogspot.toomuchcoding; + +import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc; +import org.junit.Before; + +public class MvcTest { + + @Before + public void setup() { + RestAssuredMockMvc.standaloneSetup(new com.blogspot.toomuchcoding.frauddetection.FraudDetectionController()); + } + + public void assertThatRejectionReasonIsNull(Object rejectionReason) { + assert rejectionReason == null; + } +} \ No newline at end of file