Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUNIT: Migrate JsonOutputTest to Kotlin #1339

Merged
merged 7 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions src/test/java/sirius/web/service/JsonOutputSpec.groovy

This file was deleted.

32 changes: 32 additions & 0 deletions src/test/kotlin/sirius/web/service/JsonOutputTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Made with all the love in the world
* by scireum in Remshalden, Germany
*
* Copyright by scireum GmbH
* http://www.scireum.de - info@scireum.de
*/

package sirius.web.service


import sirius.kernel.xml.Attribute
import sirius.web.services.JSONStructuredOutput
import java.io.ByteArrayOutputStream

import kotlin.test.Test
import kotlin.test.assertEquals
/**
* Tests the [JSONStructuredOutput] class.
*/
class JsonOutputTest {
@Test
fun `json output uses attributes`() {
val os = ByteArrayOutputStream()
Copy link
Contributor

@mko-sci mko-sci Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe remove double whitespace?

val out = JSONStructuredOutput(os, null, "UTF8");
out.beginResult("test")
out.beginObject("1", Attribute.set("a", "b"))
out.endObject()
out.endResult()
assertEquals("""{"1":{"a":"b"}}""",os.toString())
}
}