NetworkSessionController implements ParseSessionController { @Override public Task<ParseObject.State> upgradeToRevocable(String sessionToken) { ParseRESTSessionCommand command = ParseRESTSessionCommand.upgradeToRevocableSessionCommand(sessionToken); return command.executeAsync(client).onSuccess(new Continuation<JSONObject, ParseObject.State>() { @Override public ParseObject.State then(Task<JSONObject> task) { JSONObject result = task.getResult(); return coder.decode(new ParseObject.State.Builder("_Session"), result, ParseDecoder.get()) .isComplete(true) .build(); } }); } NetworkSessionController(ParseHttpClient client); @Override Task<ParseObject.State> getSessionAsync(String sessionToken); @Override Task<Void> revokeAsync(String sessionToken); @Override Task<ParseObject.State> upgradeToRevocable(String sessionToken);  }
@Test public void testUpgradeToRevocable() throws Exception { JSONObject mockResponse = generateBasicMockResponse(); ParseHttpClient restClient = ParseTestUtils.mockParseHttpClientWithResponse(mockResponse, 200, "OK"); NetworkSessionController controller = new NetworkSessionController(restClient); ParseObject.State newState = ParseTaskUtils.wait(controller.upgradeToRevocable("sessionToken")); verifyBasicSessionState(mockResponse, newState); assertTrue(newState.isComplete()); }