Skip to content

Commit

Permalink
Merge pull request #84 from denov/master
Browse files Browse the repository at this point in the history
added in nickname #83, language, verified, and tagline to person
  • Loading branch information
mlaccetti committed May 5, 2016
2 parents 58449b3 + cdc5a33 commit 85d7dc7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 30 deletions.
Expand Up @@ -15,17 +15,12 @@
*/
package org.springframework.social.google.api.plus;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.springframework.social.google.api.ApiEntity;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import org.springframework.social.google.api.ApiEntity;

import java.util.*;
import java.util.Map.Entry;

/**
* Model class representing a full Google profile
Expand Down Expand Up @@ -90,6 +85,14 @@ private static class Email {

private String aboutMe;

private String tagline;

private String nickname;

private String language;

private Boolean verified = false;

private String relationshipStatus;

private List<ProfileUrl> urls;
Expand Down Expand Up @@ -171,6 +174,27 @@ public String getAboutMe() {
return aboutMe;
}


public String getTagline() {
return tagline;
}


public String getNickname() {
return nickname;
}


public String getLanguage() {
return language;
}


public Boolean isVerified() {
return verified;
}


public String getRelationshipStatus() {
return relationshipStatus;
}
Expand Down
@@ -1,29 +1,24 @@
package org.springframework.social.google.api.plus;

import org.junit.Test;
import org.springframework.social.google.api.AbstractGoogleApiTest;
import org.springframework.social.google.api.plus.moments.AddActivity;
import org.springframework.social.google.api.plus.moments.Moment;
import org.springframework.social.google.api.plus.moments.MomentsPage;

import java.util.List;
import java.util.Map;

import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.POST;
import static org.junit.Assert.*;
import static org.springframework.http.HttpMethod.*;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withNoContent;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;

import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.springframework.social.google.api.AbstractGoogleApiTest;
import org.springframework.social.google.api.plus.moments.AddActivity;
import org.springframework.social.google.api.plus.moments.Moment;
import org.springframework.social.google.api.plus.moments.MomentsPage;

public class PlusTemplateTest extends AbstractGoogleApiTest {

@Test
Expand All @@ -33,8 +28,7 @@ public void getPersonById() {
.andExpect(method(GET))
.andRespond(
withSuccess(jsonResource("person"), APPLICATION_JSON));
Person person = google.plusOperations().getPerson(
"114863353858610846998");
Person person = google.plusOperations().getPerson("114863353858610846998");
assertPerson(person);
}

Expand Down Expand Up @@ -276,6 +270,10 @@ private void assertPerson(Person person) {
assertEquals("Axel", person.getFamilyName());
assertEquals("Gabriel Axel", person.getDisplayName());
assertEquals("male", person.getGender());
assertEquals("en", person.getLanguage());
assertEquals(false, person.isVerified());
assertEquals("cool beans", person.getNickname());
assertEquals("testing our code", person.getTagline());
assertEquals(
"CTO and co-founder of <a href=\"https://www.docollab.com\" rel=\"nofollow\" target=\"_blank\">Docollab</a><br />",
person.getAboutMe());
Expand Down
Expand Up @@ -15,15 +15,15 @@
*/
package org.springframework.social.google.connect;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.social.connect.UserProfile;
import org.springframework.social.google.api.Google;
import org.springframework.social.google.api.plus.Person;
import org.springframework.social.google.api.plus.PlusOperations;

import static org.junit.Assert.assertEquals;

public class GoogleAdapterTest {

private GoogleAdapter apiAdapter = new GoogleAdapter();
Expand All @@ -42,6 +42,11 @@ public void fetchProfile() {
Mockito.when(person.getFamilyName()).thenReturn("Axel");
Mockito.when(person.getAccountEmail()).thenReturn("guznik@gmail.com");
Mockito.when(person.getId()).thenReturn("114863353858610846998");
Mockito.when(person.getTagline()).thenReturn("testing our code");
Mockito.when(person.getNickname()).thenReturn("cool beans");
Mockito.when(person.getLanguage()).thenReturn("en");
Mockito.when(person.isVerified()).thenReturn(true);


Mockito.when(plusOperations.getGoogleProfile()).thenReturn(person);
UserProfile profile = apiAdapter.fetchUserProfile(google);
Expand Down
Expand Up @@ -6,7 +6,9 @@
"id": "114863353858610846998",
"objectType": "person",
"verified": false,
"etag": "\"YFr-hUROXQN7IOa3dUHg9dQ8eq0/NEVHKJoN067kdVmOajomyD-wN6Y\"",
"etag": "\"YFr-hUROXQN7IOa3dUHg9dQ8eq0/NEVHKJoN067kdVmOajomyD-wN6Y\"",
"tagline": "testing our code",
"nickname": "cool beans",
"circledByCount": 51,
"occupation": "Software Engineer",
"aboutMe": "CTO and co-founder of <a href=\"https://www.docollab.com\" rel=\"nofollow\" target=\"_blank\">Docollab</a><br />",
Expand Down

0 comments on commit 85d7dc7

Please sign in to comment.