Skip to content

Commit 47cd137

Browse files
authored
Merge pull request #81 from hauner/groovy-3
Groovy 3
2 parents 96d3267 + 1e49177 commit 47cd137

4 files changed

Lines changed: 47 additions & 16 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,16 @@ jobs:
1919
with:
2020
java-version: 11.0.2
2121
- name: build
22-
run: ./gradlew build
22+
run: ./gradlew build --stacktrace
23+
- name: archive artifacts
24+
uses: actions/upload-artifact@v1
25+
if: success()
26+
with:
27+
name: artifacts
28+
path: build/libs
29+
- name: archive test results
30+
uses: actions/upload-artifact@v1
31+
if: always()
32+
with:
33+
name: test results
34+
path: build/reports

build.gradle

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,37 @@ ext {
2626
repositories {
2727
mavenCentral()
2828
jcenter()
29+
maven {
30+
url "https://oss.sonatype.org/content/repositories/snapshots"
31+
}
2932
maven {
3033
url "https://dl.bintray.com/hauner/openapi-generatr"
3134
}
3235
}
3336

37+
test {
38+
useJUnitPlatform()
39+
}
40+
3441
testSets {
3542
testInt
3643
}
3744

3845
check.dependsOn testInt
3946

4047
dependencies {
41-
implementation 'org.codehaus.groovy:groovy:2.5.4'
48+
implementation 'org.codehaus.groovy:groovy:3.0.0'
4249
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
4350
implementation 'io.swagger.parser.v3:swagger-parser:2.0.17'
4451
implementation 'com.google.googlejavaformat:google-java-format:1.7'
4552
compileOnly "com.github.hauner.openapi:openapi-generatr-api:$generatrApiVersion"
4653

47-
testImplementation 'net.bytebuddy:byte-buddy:1.9.13'
48-
testImplementation ('org.spockframework:spock-core:1.3-groovy-2.5') {
49-
// avoid conflicts with explicit groovy version
50-
exclude group: 'org.codehaus.groovy'
54+
testImplementation ('org.spockframework:spock-core:2.0-M2-groovy-3.0') {
55+
exclude group: 'org.codehaus.groovy' // avoid conflicts with explicit groovy version
5156
}
57+
testImplementation 'org.spockframework:spock-junit4:2.0-M2-groovy-3.0'
58+
testImplementation 'net.bytebuddy:byte-buddy:1.9.13'
59+
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
5260

5361
testIntImplementation "com.github.hauner.openapi:openapi-generatr-api:$generatrApiVersion"
5462
testIntImplementation 'io.github.java-diff-utils:java-diff-utils:4.5'

src/test/groovy/com/github/hauner/openapi/spring/converter/ApiConverterErrorSpec.groovy

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 the original authors
2+
* Copyright 2019-2020 the original authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,18 +16,28 @@
1616

1717
package com.github.hauner.openapi.spring.converter
1818

19-
import com.github.hauner.openapi.spring.model.Api
20-
import com.github.hauner.openapi.spring.support.Sl4jMockRule
21-
import org.junit.Rule
22-
import org.slf4j.Logger
19+
import ch.qos.logback.classic.Level
20+
import ch.qos.logback.classic.spi.ILoggingEvent
21+
import ch.qos.logback.core.read.ListAppender
2322
import spock.lang.Specification
23+
import spock.lang.Subject
2424

2525
import static com.github.hauner.openapi.spring.support.OpenApiParser.parse
2626

2727
class ApiConverterErrorSpec extends Specification {
2828

29-
def log = Mock Logger
30-
@Rule Sl4jMockRule rule = new Sl4jMockRule(ApiConverter, log)
29+
@Subject
30+
def converter
31+
32+
def appender
33+
34+
void setup() {
35+
converter = new ApiConverter ()
36+
37+
appender = new ListAppender<ILoggingEvent> ()
38+
appender.start ()
39+
converter.log.addAppender (appender)
40+
}
3141

3242
void "logs error when datatype conversion fails" () {
3343
def openApi = parse ("""\
@@ -48,12 +58,12 @@ paths:
4858
type: unknown
4959
""")
5060
when:
51-
log.isErrorEnabled () >> true
52-
Api api = new ApiConverter ().convert (openApi)
61+
converter.convert (openApi)
5362

5463
then:
5564
notThrown (UnknownDataTypeException)
56-
1 * log.error (*_)
65+
appender.list.size () == 1
66+
appender.list.first ().level == Level.ERROR
5767
}
5868

5969
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<configuration />

0 commit comments

Comments
 (0)