BooleanJsonMapper { public Boolean transformBoolean( String booleanJsonResponse ) throws JsonSyntaxException { JsonObject rootObject = parser.parse( booleanJsonResponse ).getAsJsonObject(); return rootObject.get( "bool" ).getAsBoolean(); } @Inject  BooleanJsonMapper(); Boolean transformBoolean( String booleanJsonResponse );  }
@Test public void testTransformBooleanHappyCase() { Boolean booleanEntity = booleanJsonMapper.transformBoolean( JSON_RESPONSE ); assertThat( booleanEntity, is( false ) ); }
@Test( expected = JsonSyntaxException.class ) public void testTransformLiveStreamInfoEntityBadJson() { booleanJsonMapper.transformBoolean( JSON_RESPONSE_BAD ); }