This file contains hidden or 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
| it("should do nothing", { | |
| given("I have nothing", { | |
| on("not doing anything", { | |
| }) | |
| }) | |
| }) |
This file contains hidden or 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
| var spaceReplace = { String.(char: Char): String -> this.replace(' ', char) } | |
| val output = "This is an example".spaceReplace('_') | |
| // outputs: This_is_an_example |
This file contains hidden or 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
| public fun given(description : String, givenExpression: Given.() -> Unit) { | |
| // code omitted | |
| } | |
| public class Given { | |
| public fun on(description: String, onExpression: On.() -> Unit) { | |
| // code omitted | |
| } | |
| } |
This file contains hidden or 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
| public class Given { | |
| public fun on(description: String, onExpression: On.() -> Unit) { | |
| // code omitted | |
| } | |
| } | |
This file contains hidden or 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
| route.get("/abc", { req, res -> res.send("Hello") }) | |
| route("/abc", { | |
| get { req, res -> res.send("Hello") } | |
| post { req, res -> req.process(body) } | |
| } | |
This file contains hidden or 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
| resource "/customer" get { response.send("a....") } | |
This file contains hidden or 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
| resource public fun CustomerResources() { | |
| "/customer" get { | |
| } | |
| "/customer" post { |
This file contains hidden or 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
| val server = AppServer() | |
| Routes.get("/good",{ response.send("Well this means that routes now work!")}) | |
| Routes.get("/",{ response.send("Hello, how are you")}) | |
| "/customer" post { response.send("abc") } | |
This file contains hidden or 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
| <?xml version=\"1.0\" encoding=\"UTF-8\"?><response><statusCode>200</statusCode><statusText>Test Complete</statusText><data><statusCode>200</statusCode><statusText>Test Complete</statusText><testId>130511_3N_P78</testId><runs>1</runs><fvonly>0</fvonly><remote></remote><testsExpected>2</testsExpected><location>Dulles_IE9</location><startTime>05/11/13 18:57:43</startTime><elapsed>178752</elapsed><completeTime>05/11/13 18:57:51</completeTime><testsCompleted>2</testsCompleted></data></response> | |
This file contains hidden or 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
| Routes.get("/customer/10", { | |
| val obj = object { | |
| val name = "John" | |
| } | |
| response.send(obj, ContentType.ApplicationJson) | |
| }) |