private void doFireProfile(Frame frame) { if (handlers != null) { for (ProfileHandler handler : this.handlers) { if (handler.shouldCaptureProfile(null)) { handler.fireProfile(frame); } } } }
/** * Should we even profile. * * @param args * @return */ private boolean shouldCaptureData(Object[] args) { if (handlers == null) { return false; } for (ProfileHandler handler : this.handlers) { if (handler.shouldCaptureProfile(args)) { return true; } } return false; }
@Test public void itShouldGetProfile() { GoogleOAuthClient googleOAuthClient = mock(GoogleOAuthClient.class); ProfileHandler profileHandler = new ProfileHandler(googleOAuthClient); String accessToken = "access_token"; GoogleProfile expectedProfile = mock(GoogleProfile.class); when(googleOAuthClient.getProfile(accessToken)).thenReturn(expectedProfile); GoogleProfile actualProfile = profileHandler.getProfile(accessToken); verify(googleOAuthClient).getProfile(accessToken); assertThat(actualProfile).isEqualTo(expectedProfile); }