package com.sanction.lightning.resources;

import com.sanction.lightning.authentication.Key;
import com.sanction.lightning.facebook.FacebookProviderFactory;
import com.sanction.thunder.ThunderClient;

import javax.ws.rs.core.Response;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;

public class FacebookResourceTest {
  private final ThunderClient client = mock(ThunderClient.class);
  private final FacebookProviderFactory providerFactory = mock(FacebookProviderFactory.class);
  private final Key key = mock(Key.class);

  private final FacebookResource resource = new FacebookResource(client, providerFactory);

  @Test
  public void testGetNullUsername() {
    Response response = resource.getUser(key, null);

    assertEquals(response.getStatusInfo(), Response.Status.BAD_REQUEST);
  }

}

@@ -36,16 +36,68 @@
 urces;%0A%0A
+import com.restfb.exception.FacebookOAuthException;%0A
 import c
@@ -197,58 +197,212 @@
 ider
-Factory;%0Aimport com.sanction.thunder.ThunderClient
+;%0Aimport com.sanction.lightning.facebook.FacebookProviderFactory;%0Aimport com.sanction.lightning.models.FacebookUser;%0Aimport com.sanction.thunder.ThunderClient;%0Aimport com.sanction.thunder.models.StormUser
 ;%0A%0Ai
@@ -435,16 +435,41 @@
 ponse;%0A%0A
+import org.junit.Before;%0A
 import o
@@ -560,19 +560,105 @@
 to.M
-ockito.mock
+atchers.anyString;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when
 ;%0A%0Ap
@@ -873,126 +873,949 @@
 nal 
-Key key = mock(Key.class);%0A%0A  private final FacebookResource resource = new FacebookResource(client, providerFactory);
+FacebookProvider facebookProvider = mock(FacebookProvider.class);%0A  private final Key key = mock(Key.class);%0A%0A  private final StormUser stormUser = mock(StormUser.class);%0A  private final FacebookUser facebookUser = mock(FacebookUser.class);%0A%0A  private final FacebookResource resource = new FacebookResource(client, providerFactory);%0A%0A  @Before%0A  public void setup() %7B%0A    when(providerFactory.newFacebookProvider(anyString())).thenReturn(facebookProvider);%0A    when(client.getUser(anyString())).thenReturn(stormUser);%0A%0A    when(stormUser.getFacebookAccessToken()).thenReturn(%22fbAccessToken%22);%0A%0A    when(facebookUser.getFacebookId()).thenReturn(%221%22);%0A    when(facebookUser.getFirstName()).thenReturn(%22Bill%22);%0A    when(facebookUser.getMiddleName()).thenReturn(%22Joe%22);%0A    when(facebookUser.getLastName()).thenReturn(%22Nye%22);%0A    when(facebookUser.getName()).thenReturn(%22Bill Joe Nye%22);%0A    when(facebookUser.getGender()).thenReturn(%22Male%22);%0A  %7D
 %0A%0A  
@@ -1841,16 +1841,24 @@
  testGet
+UserWith
 NullUser
@@ -1998,10 +1998,666 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void testGetUser() %7B%0A    when(facebookProvider.getFacebookUser()).thenReturn(facebookUser);%0A%0A    Response response = resource.getUser(key, %22Test%22);%0A    FacebookUser userResponse = (FacebookUser) response.getEntity();%0A%0A    assertEquals(response.getStatusInfo(), Response.Status.OK);%0A    assertEquals(userResponse, facebookUser);%0A  %7D%0A%0A  @Test%0A  @SuppressWarnings(%22unchecked%22)%0A  public void testGetUserWithExpiredOAuth() %7B%0A    when(facebookProvider.getFacebookUser()).thenThrow(FacebookOAuthException.class);%0A%0A    Response response = resource.getUser(key, %22Test%22);%0A%0A    assertEquals(response.getStatusInfo(), Response.Status.NOT_FOUND);%0A  %7D%0A%0A
 %7D%0A

Add more unit tests