summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2024-02-07 17:07:25 +0000
committerToineSiebelink <toine.siebelink@est.tech>2024-02-08 11:27:01 +0000
commita670176caac46fb68ef0a8ced0160c980f4cce05 (patch)
tree566bdf839c98825b9b5ed4e5b0e53ab9993e420d /cps-ncmp-rest
parenta3096b9d22b7a3517c7933dfeb10984f6bedf063 (diff)
Correct use of Spock setup and cleanup methods (no need for @Before @After)
- unfortunately we copied the bad test code for logging about 4 times alraedy... - simplified setup for WatchdogSchedulingConfigurerSpec Issue-ID:CPS-465 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I8d068541263272fdf99a6e30d365d85e31726432
Diffstat (limited to 'cps-ncmp-rest')
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/executor/CpsNcmpTaskExecutorSpec.groovy6
1 files changed, 1 insertions, 5 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/executor/CpsNcmpTaskExecutorSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/executor/CpsNcmpTaskExecutorSpec.groovy
index 5f62aca684..010eda964d 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/executor/CpsNcmpTaskExecutorSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/executor/CpsNcmpTaskExecutorSpec.groovy
@@ -24,8 +24,6 @@ import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import ch.qos.logback.classic.spi.ILoggingEvent
import ch.qos.logback.core.read.ListAppender
-import org.junit.jupiter.api.AfterEach
-import org.junit.jupiter.api.BeforeEach
import org.slf4j.LoggerFactory
import spock.lang.Specification
import spock.util.concurrent.PollingConditions
@@ -36,14 +34,12 @@ class CpsNcmpTaskExecutorSpec extends Specification {
def logger = Spy(ListAppender<ILoggingEvent>)
def enoughTime = 100
- @BeforeEach
void setup() {
((Logger) LoggerFactory.getLogger(CpsNcmpTaskExecutor.class)).addAppender(logger)
logger.start()
}
- @AfterEach
- void teardown() {
+ void cleanup() {
((Logger) LoggerFactory.getLogger(CpsNcmpTaskExecutor.class)).detachAndStopAllAppenders()
}