Skip to content

Commit

Permalink
add complex type test
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed Nov 28, 2024
1 parent 78eee2e commit eec0c92
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stove-testing-e2e-mongodb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies {
}

dependencies {
testImplementation(libs.slf4j.simple)
testImplementation(libs.logback.classic)
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,48 @@ class MongodbTestSystemTests : FunSpec({
}
}
}

test("complex type") {
data class Nested(
val id: String,
val name: String
)

data class ComplexType(
val id: String,
val name: String,
val nested: Nested
)

val id = ObjectId()
val nestedId = ObjectId()
validate {
mongodb {
save(
ComplexType(
id = id.toHexString(),
name = "name",
nested = Nested(
id = nestedId.toHexString(),
name = "nested"
)
),
id.toHexString()
)
shouldGet<ComplexType>(id.toHexString()) { actual ->
actual.id shouldBe id.toHexString()
actual.name shouldBe "name"
actual.nested.id shouldBe actual.nested.id
actual.nested.name shouldBe "nested"
}

shouldQuery<ComplexType>(
query = "{\"nested.id\": \"${nestedId.toHexString()}\"}"
) { actual ->
actual.size shouldBe 1
actual.first().id shouldBe id.toHexString()
}
}
}
}
})
20 changes: 20 additions & 0 deletions lib/stove-testing-e2e-mongodb/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%white([%t]) %highlight(%-5level) %magenta(%c{1}) %cyan(trace.id:%X{traceId} version:%X{version}) -
%yellow(%m) %n
</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
<logger name="org.testcontainers" level="WARN"/>
<logger name="tc" level="OFF"/>
<logger name="com.github.dockerjava" level="OFF"/>
<logger name="com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire" level="OFF"/>
<logger name="org.apache" level="OFF"/>
</configuration>

0 comments on commit eec0c92

Please sign in to comment.