StateMachineAdapter implements TypeAdapter<StateMachine, String> { @Override public String adapt(StateMachine stateMachine) { return stateMachine == null ? null : stateMachine.toJson(); }  @Override String adapt(StateMachine stateMachine);  }
@Test public void simpleStateMachine_AdaptsCorrectlyToJson() { String expected = "{\n" + " \"StartAt\":\"Succeed\",\n" + " \"States\":{\n" + " \"Succeed\":{\n" + " \"Type\":\"Succeed\"\n" + " }\n" + " }\n" + "}"; String actual = new StateMachineAdapter().adapt(StateMachine.builder() .state("Succeed", succeedState()) .startAt("Succeed") .build()); assertJsonEquals(expected, actual); }