### Question:
RequestStartTransactionJsonCommandHandler extends JsonCommandHandler { @Override public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException { ChargingStationId csId = new ChargingStationId(chargingStationId); if (!commandAuthorizationService.isAuthorized(csId, identityContext.getUserIdentity(), RequestStartTransactionCommand.class)) { throw new UserIdentityUnauthorizedException(chargingStationId, identityContext.getUserIdentity(), RequestStartTransactionCommand.class); } try { ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation != null && chargingStation.communicationAllowed()) { RequestStartTransactionApiCommand command = gson.fromJson(commandObject, RequestStartTransactionApiCommand.class); commandGateway.send(new RequestStartTransactionCommand(csId, command.getIdentifyingToken(), command.getEvseId(), identityContext), new CorrelationToken()); } else { throw new IllegalStateException("It is not possible to request a start transaction on a charging station that is not registered"); } } catch (JsonSyntaxException ex) { throw new IllegalArgumentException("Start transaction command is not able to parse the payload, is your json correctly formatted?", ex); } }  @Override String getCommandName(); @Override void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext);  }### Answer:
@Test public void testStartTransaction() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1',identifyingToken:{token:'1',status:'ACCEPTED', mobilityServiceProvider:'MSP', visibleId:'7007'}}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }
@Test public void testStartTransactionNoStatus() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1',identifyingToken:{token:'1'}}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }
@Test(expected = NullPointerException.class) public void testStartTransactionNoToken() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1'}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }
@Test(expected = JsonParseException.class) public void testStartTransactionIdentifyingTokenIsString() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1',identifyingToken:'ACCEPTED'}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }
@Test(expected = JsonParseException.class) public void testStartTransactionTokenIsObject() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1',identifyingToken:{token:{status:'ACCEPTED'}}}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }
@Test(expected = JsonParseException.class) public void testStartTransactionStatusIsObject() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1',identifyingToken:{token:'1',status:{status:'ACCEPTED'}}}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }
@Test(expected = IllegalArgumentException.class) public void testStartTransactionStatusInvalid() throws UserIdentityUnauthorizedException { JsonObject command = gson.fromJson("{evseId:'1',identifyingToken:{token:'1',status:'NEW'}}", JsonObject.class); handler.handle(CHARGING_STATION_ID_STRING, command, ROOT_IDENTITY_CONTEXT); }