Migrating from JAXB XML processing to XStream

6 minute read - REST API Java For Testers

TLDR: refactored to isolate XML processing, configured XStream in code, removed all annotations, added XML header, wrote less code

I have a small REST API application which uses Spark and GSON and JAXB. I haven’t released this to Github yet but I did release some of the example externally executed []integration verification code](https://github.com/eviltester/automating-rest-api) for it.

When trying to package this for Java 1.9 I encountered the, now standard, missing JAXB, libraries. So I thought I’d investigate another XML library.


Implementing PATCH Verbs with Gson Jaxb and Spark Framework

7 minute read - REST API

TLDR; HttpURLConnection does not support PATCH, but we can sometimes use X-HTTP-Method-Override instead (this works with Spark Framework). I can Patch POJO using reflection, or deserialize to simple POJO and compare with null values instead I had not planned to implement PATCH in my testing web service - at all, ever… But Mark Turner’s comment on my previous blog post made me reconsider and now I’ll try and aim for as many HTTP verbs as I can.

Architecting a Testable Web Service in Spark Framework

7 minute read - REST API

Architecting a Testable Web Service in Spark Framework TLDR; Architecting a Web Service using Spark Framework to support more Unit testing and allow the inclusion of HTTP @Test methods in the build without deploying the application. Create API as a POJO. Start Spark in @BeforeClass, stop it in @AfterClass, make simple HTTP calls. Background to the Spark and REST Web App Testing I’m writing a REST Web App to help me manage my online training courses.