@Test public void testPermission_whenPermissionIsGranted_thenShouldReturnLocation() throws Exception { RootRequest rootRequest = TestObjects.permissionGrantedLocationRequest(true); PermissionRequestHandler permissionRequestHandler = new PermissionRequestHandler(rootRequest) { @Override public RootResponse getResponse() { return new RootResponse(); } }; Location location = permissionRequestHandler.getLocation(); assertNotNull(location); assertEquals(rootRequest.device.location, location); }
@Nullable public Location getLocation() { if (isPermissionGranted()) { return getRootRequest().device.location; } else { return null; } }
PermissionRequestHandler extends RequestHandler { @Nullable public Location getLocation() { if (isPermissionGranted()) { return getRootRequest().device.location; } else { return null; } } }
PermissionRequestHandler extends RequestHandler { @Nullable public Location getLocation() { if (isPermissionGranted()) { return getRootRequest().device.location; } else { return null; } } protected  PermissionRequestHandler(RootRequest rootRequest); }
PermissionRequestHandler extends RequestHandler { @Nullable public Location getLocation() { if (isPermissionGranted()) { return getRootRequest().device.location; } else { return null; } } protected  PermissionRequestHandler(RootRequest rootRequest); boolean isPermissionGranted(); @Nullable UserProfile getUserProfile(); @Nullable Location getLocation(); }
PermissionRequestHandler extends RequestHandler { @Nullable public Location getLocation() { if (isPermissionGranted()) { return getRootRequest().device.location; } else { return null; } } protected  PermissionRequestHandler(RootRequest rootRequest); boolean isPermissionGranted(); @Nullable UserProfile getUserProfile(); @Nullable Location getLocation();  }