Ratpacked: Using Spring Cloud Contract To Implement Server
Spring Cloud Contract is a project that allows to write a contract for a service using a Groovy DSL. In the contract we describe the expected requests and responses for the service. From this contract...
View ArticleRatpacked: Using Spring Cloud Contract As Client
In a previous post we learned about Spring Cloud Contract. We saw how we can use contracts to implement the server side of the contract. But Spring Cloud Contract also creates a stub based on the...
View ArticleRatpacked: Implement A Custom Request Parser
Ratpack has parsers to parse a request with a JSON body or a HTML form. We simply use the parse method of Context and Ratpack will check if there is a compliant parser in the registry. If there is a …...
View ArticleRatpacked: Implement Custom Rendering With Renderable Interface
Ratpack uses renderers to render output. We can create our own renderer by implementing the Renderer interface. The renderer class needs to implement a render method that has the object we want to...
View ArticleRatpacked: Type Check And Static Compilation For Groovy DSL
One of the very nice features of Ratpack is the Groovy DSL to define our application. We get a nice DSL to set up the registry, to define handlers and more. Because of clever use of the @DelegateTo...
View ArticleRatpacked: Combine Groovy DSL With RatpackServer Java Configuration
We have several options to define a Ratpack application. We can use a Java syntax to set up the bindings and handlers. Or we can use the very nice Groovy DSL. It turns out we can use both together as …...
View ArticleRatpacked: Override Registry Objects With Mocks In Integration Specifications
Testing a Ratpack application is not difficult. Ratpack has excellent support for writing unit and integration tests. When we create the fixture MainClassApplicationUnderTest we can override the method...
View ArticleRatpacked: Add Ratpack To Spring Boot Application
In a previous post we saw how we can use Spring Boot in a Ratpack application. But the integration can also be the other way around: using Ratpack in a Spring Boot application. This way we can use...
View ArticleRatpacked: Conditionally Map Or Flatmap A Promise
When we want to transform a Promise value we can use the map and flatMap methods. There are also variants to this methods that will only transform a value when a given predicate is true: mapIf and...
View ArticleRatpacked: Assert No Exceptions Are Thrown With RequestFixture
Writing unit tests for our handlers in Ratpack is easy with RequestFixture. We invoke the handle method and use a Handler or Chain we want to test as argument. We can provide extra details on the...
View Article