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