-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added deprecation feature * Added JAX-RS test * Added Micronaut test * Added OpenApi test * Added RAML test and fixed bug * Added Spring test, fixed bug * Fixed wording * CR fixes + rebase
- Loading branch information
Showing
29 changed files
with
605 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...s/src/test/kotlin/de/codecentric/hikaku/converters/jaxrs/JaxRsConverterDeprecationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package de.codecentric.hikaku.converters.jaxrs | ||
|
||
import de.codecentric.hikaku.endpoints.Endpoint | ||
import de.codecentric.hikaku.endpoints.HttpMethod.GET | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
|
||
class JaxRsConverterDeprecationTest { | ||
|
||
@Test | ||
fun `no deprecation`() { | ||
// given | ||
val specification = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
deprecated = false | ||
) | ||
) | ||
|
||
//when | ||
val result = JaxRsConverter("test.jaxrs.deprecation.none").conversionResult | ||
|
||
//then | ||
assertThat(result).containsExactlyInAnyOrderElementsOf(specification) | ||
} | ||
|
||
@Test | ||
fun `deprecated class`() { | ||
// given | ||
val specification = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
deprecated = true | ||
) | ||
) | ||
|
||
//when | ||
val result = JaxRsConverter("test.jaxrs.deprecation.onclass").conversionResult | ||
|
||
//then | ||
assertThat(result).containsExactlyInAnyOrderElementsOf(specification) | ||
} | ||
|
||
@Test | ||
fun `deprecated function`() { | ||
// given | ||
val specification = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
deprecated = true | ||
) | ||
) | ||
|
||
//when | ||
val result = JaxRsConverter("test.jaxrs.deprecation.onfunction").conversionResult | ||
|
||
//then | ||
assertThat(result).containsExactlyInAnyOrderElementsOf(specification) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
jax-rs/src/test/kotlin/test/jaxrs/deprecation/none/NoDeprecation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package test.jaxrs.deprecation.none | ||
|
||
import javax.ws.rs.GET | ||
import javax.ws.rs.Path | ||
|
||
@Path("/todos") | ||
class NoDeprecation { | ||
|
||
@GET | ||
fun todo() { } | ||
} |
12 changes: 12 additions & 0 deletions
12
jax-rs/src/test/kotlin/test/jaxrs/deprecation/onclass/DeprecationOnClass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package test.jaxrs.deprecation.onclass | ||
|
||
import javax.ws.rs.GET | ||
import javax.ws.rs.Path | ||
|
||
@Path("/todos") | ||
@Deprecated("Test") | ||
class DeprecationOnClass { | ||
|
||
@GET | ||
fun todo() { } | ||
} |
12 changes: 12 additions & 0 deletions
12
jax-rs/src/test/kotlin/test/jaxrs/deprecation/onfunction/DeprecationOnFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package test.jaxrs.deprecation.onfunction | ||
|
||
import javax.ws.rs.GET | ||
import javax.ws.rs.Path | ||
|
||
@Path("/todos") | ||
class DeprecationOnFunction { | ||
|
||
@GET | ||
@Deprecated("Test") | ||
fun todo() { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...st/kotlin/de/codecentric/hikaku/converters/micronaut/MicronautConverterDeprecationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package de.codecentric.hikaku.converters.micronaut | ||
|
||
import de.codecentric.hikaku.endpoints.Endpoint | ||
import de.codecentric.hikaku.endpoints.HttpMethod.GET | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
|
||
class MicronautConverterDeprecationTest { | ||
|
||
@Test | ||
fun `no deprecation`() { | ||
// given | ||
val specification = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
deprecated = false | ||
) | ||
) | ||
|
||
//when | ||
val result = MicronautConverter("test.micronaut.deprecation.none").conversionResult | ||
|
||
//then | ||
assertThat(result).containsExactlyInAnyOrderElementsOf(specification) | ||
} | ||
|
||
@Test | ||
fun `deprecated class`() { | ||
// given | ||
val specification = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
deprecated = true | ||
) | ||
) | ||
|
||
//when | ||
val result = MicronautConverter("test.micronaut.deprecation.onclass").conversionResult | ||
|
||
//then | ||
assertThat(result).containsExactlyInAnyOrderElementsOf(specification) | ||
} | ||
|
||
@Test | ||
fun `deprecated function`() { | ||
// given | ||
val specification = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
deprecated = true | ||
) | ||
) | ||
|
||
//when | ||
val result = MicronautConverter("test.micronaut.deprecation.onfunction").conversionResult | ||
|
||
//then | ||
assertThat(result).containsExactlyInAnyOrderElementsOf(specification) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
micronaut/src/test/kotlin/test/micronaut/deprecation/none/NoDeprecation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package test.micronaut.deprecation.none | ||
|
||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Get | ||
|
||
@Controller("/todos") | ||
class NoDeprecation { | ||
|
||
@Get | ||
fun todo() { } | ||
} |
12 changes: 12 additions & 0 deletions
12
micronaut/src/test/kotlin/test/micronaut/deprecation/onclass/DeprecationOnClass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package test.micronaut.deprecation.onclass | ||
|
||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Get | ||
|
||
@Controller("/todos") | ||
@Deprecated("Test") | ||
class DeprecationOnClass { | ||
|
||
@Get | ||
fun todo() { } | ||
} |
12 changes: 12 additions & 0 deletions
12
micronaut/src/test/kotlin/test/micronaut/deprecation/onfunction/DeprecationOnFunction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package test.micronaut.deprecation.onfunction | ||
|
||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Get | ||
|
||
@Controller("/todos") | ||
class DeprecationOnFunction { | ||
|
||
@Get | ||
@Deprecated("Test") | ||
fun todo() { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...c/test/kotlin/de/codecentric/hikaku/converters/openapi/OpenApiConverterDeprecationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package de.codecentric.hikaku.converters.openapi | ||
|
||
import de.codecentric.hikaku.endpoints.Endpoint | ||
import de.codecentric.hikaku.endpoints.HttpMethod.GET | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import java.nio.file.Paths | ||
|
||
class OpenApiConverterDeprecationTest { | ||
|
||
@Test | ||
fun `no deprecation`() { | ||
//given | ||
val file = Paths.get(this::class.java.classLoader.getResource("deprecation/deprecation_none.yaml").toURI()) | ||
val implementation = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
produces = setOf("application/json"), | ||
deprecated = false | ||
) | ||
) | ||
|
||
//when | ||
val specification = OpenApiConverter(file) | ||
|
||
//then | ||
assertThat(specification.conversionResult).containsExactlyInAnyOrderElementsOf(implementation) | ||
} | ||
|
||
@Test | ||
fun `deprecated operation`() { | ||
//given | ||
val file = Paths.get(this::class.java.classLoader.getResource("deprecation/deprecation_operation.yaml").toURI()) | ||
val implementation = setOf( | ||
Endpoint( | ||
path = "/todos", | ||
httpMethod = GET, | ||
produces = setOf("application/json"), | ||
deprecated = true | ||
) | ||
) | ||
|
||
//when | ||
val specification = OpenApiConverter(file) | ||
|
||
//then | ||
assertThat(specification.conversionResult).containsExactlyInAnyOrderElementsOf(implementation) | ||
} | ||
} |
Oops, something went wrong.