@Test
public void testToJsonThrows() {

    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("failed to convert to json: required field a cannot be null");
    RequiredObject obj = new RequiredObject(null);
    B2Json.toJsonOrThrowRuntime(obj);
}