Skip to content

Commit 14b19b9

Browse files
authored
refactor: Call consolidated newTestContext function for test setup over generateTestContext (#116)
1 parent c5889db commit 14b19b9

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/protocols/core/EndpointResolverGeneratorTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ package aws.sdk.kotlin.codegen.protocols.core
88
import io.kotest.matchers.string.shouldContainOnlyOnce
99
import org.junit.jupiter.api.Test
1010
import software.amazon.smithy.build.MockManifest
11-
import software.amazon.smithy.kotlin.codegen.test.generateTestContext
11+
import software.amazon.smithy.kotlin.codegen.test.newTestContext
1212
import software.amazon.smithy.kotlin.codegen.test.toSmithyModel
1313
import software.amazon.smithy.model.node.Node
1414

1515
class EndpointResolverGeneratorTest {
1616

1717
private fun getGeneratedResolverContents(model: String): String {
18-
val ctx = model.toSmithyModel().generateTestContext("test", "Example")
18+
val (ctx, _, _) = model.toSmithyModel().newTestContext("Example", "test")
1919
val endpointData = Node.parse(endpointsJson).expectObjectNode()
2020
EndpointResolverGenerator(endpointData).render(ctx)
2121
ctx.delegator.flushWriters()

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/protocols/json/AwsJsonHttpBindingResolverTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package aws.sdk.kotlin.codegen.protocols.json
88
import org.junit.jupiter.api.Assertions
99
import org.junit.jupiter.api.Test
1010
import software.amazon.smithy.kotlin.codegen.model.expectShape
11-
import software.amazon.smithy.kotlin.codegen.test.generateTestContext
11+
import software.amazon.smithy.kotlin.codegen.test.newTestContext
1212
import software.amazon.smithy.kotlin.codegen.test.toSmithyModel
1313
import software.amazon.smithy.model.knowledge.HttpBinding
1414
import software.amazon.smithy.model.shapes.OperationShape
@@ -47,7 +47,7 @@ class AwsJsonHttpBindingResolverTest {
4747

4848
@Test
4949
fun `it resolves all operations associated with a service`() {
50-
val ctx = testModel.generateTestContext("smithy.example", "Example")
50+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
5151

5252
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
5353

@@ -59,7 +59,7 @@ class AwsJsonHttpBindingResolverTest {
5959

6060
@Test
6161
fun `it returns no request bindings for operations without inputs`() {
62-
val ctx = testModel.generateTestContext("smithy.example", "Example")
62+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
6363
val operation = testModel.expectShape<OperationShape>("smithy.example#GetEmptyFoo")
6464
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
6565

@@ -70,7 +70,7 @@ class AwsJsonHttpBindingResolverTest {
7070

7171
@Test
7272
fun `it returns request bindings for operations with inputs`() {
73-
val ctx = testModel.generateTestContext("smithy.example", "Example")
73+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
7474
val operation = testModel.expectShape<OperationShape>("smithy.example#GetFoo")
7575
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
7676

@@ -87,7 +87,7 @@ class AwsJsonHttpBindingResolverTest {
8787

8888
@Test
8989
fun `it returns no response bindings for operations without inputs`() {
90-
val ctx = testModel.generateTestContext("smithy.example", "Example")
90+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
9191
val operation = testModel.expectShape<OperationShape>("smithy.example#GetEmptyFoo")
9292
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
9393

@@ -98,7 +98,7 @@ class AwsJsonHttpBindingResolverTest {
9898

9999
@Test
100100
fun `it returns response bindings for operations with inputs`() {
101-
val ctx = testModel.generateTestContext("smithy.example", "Example")
101+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
102102
val operation = testModel.expectShape<OperationShape>("smithy.example#GetFoo")
103103
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
104104

@@ -115,7 +115,7 @@ class AwsJsonHttpBindingResolverTest {
115115

116116
@Test
117117
fun `it returns no response bindings for structures without members`() {
118-
val ctx = testModel.generateTestContext("smithy.example", "Example")
118+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
119119
val structure = testModel.expectShape<StructureShape>("smithy.example#GetFooError")
120120
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
121121

@@ -126,7 +126,7 @@ class AwsJsonHttpBindingResolverTest {
126126

127127
@Test
128128
fun `it returns response bindings for structures with members`() {
129-
val ctx = testModel.generateTestContext("smithy.example", "Example")
129+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
130130
val structure = testModel.expectShape<StructureShape>("smithy.example#GetFooOutput")
131131
val unit = AwsJsonHttpBindingResolver(ctx, "application/json")
132132

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/protocols/json/AwsJsonModeledExceptionsFeatureTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import io.kotest.matchers.string.shouldContainOnlyOnce
99
import org.junit.jupiter.api.Assertions
1010
import org.junit.jupiter.api.Test
1111
import software.amazon.smithy.kotlin.codegen.test.generateCode
12-
import software.amazon.smithy.kotlin.codegen.test.generateTestContext
12+
import software.amazon.smithy.kotlin.codegen.test.newTestContext
1313
import software.amazon.smithy.kotlin.codegen.test.toSmithyModel
1414

1515
class AwsJsonModeledExceptionsFeatureTest {
@@ -39,7 +39,7 @@ class AwsJsonModeledExceptionsFeatureTest {
3939
register(code = "GetFooError", deserializer = GetFooErrorDeserializer())
4040
""".trimIndent()
4141

42-
val ctx = testModel.generateTestContext("smithy.example", "Example")
42+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
4343

4444
val bindingResolver = AwsJsonHttpBindingResolver(ctx, "application/json")
4545
val unit = AwsJsonModeledExceptionsMiddleware(ctx, bindingResolver)
@@ -65,7 +65,7 @@ class AwsJsonModeledExceptionsFeatureTest {
6565
operation GetFoo { }
6666
""".toSmithyModel()
6767

68-
val ctx = testModel.generateTestContext("smithy.example", "Example")
68+
val (ctx, _, _) = testModel.newTestContext("Example", "smithy.example")
6969
val bindingResolver = AwsJsonHttpBindingResolver(ctx, "application/json")
7070
val unit = AwsJsonModeledExceptionsMiddleware(ctx, bindingResolver)
7171

0 commit comments

Comments
 (0)