package ca.mimic.oauth2library;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
    @Test
    public void additionIsCorrect() throws Exception {
        assertEquals(4, 2 + 2);
    }
}
@@ -37,22 +37,85 @@
 ort 
-org.junit.Test
+com.squareup.moshi.Moshi;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException
 ;%0A%0Ai
@@ -416,16 +416,16 @@
 ption %7B%0A
-
         
@@ -453,10 +453,1468 @@
 );%0A    %7D
+%0A%0A    public Token createTokenFromJson() throws IOException %7B%0A        Moshi moshi = new Moshi.Builder().build();%0A        String s = %22%7B%5C%22expires_in%5C%22: 2000, %5C%22token_type%5C%22: %5C%22bearer%5C%22, %5C%22access_token%5C%22: %5C%22access_token%5C%22, %5C%22refresh_token%5C%22: %5C%22refresh_token%5C%22, %5C%22scope%5C%22: %5C%22scope%5C%22%7D%22;%0A%0A        return moshi.adapter(Token.class).fromJson(s);%0A    %7D%0A%0A    public OAuthError createErrorFromJson() throws IOException %7B%0A        Moshi moshi = new Moshi.Builder().build();%0A        String s = %22%7B%5C%22error%5C%22:%5C%22unauthorized_client%5C%22,%5C%22error_description%5C%22:%5C%22Invalid client or doesn't have the permission to make this request.%5C%22%7D%22;%0A%0A        return moshi.adapter(OAuthError.class).fromJson(s);%0A    %7D%0A%0A    @Test%0A    public void tokenCheck() throws Exception %7B%0A        Token token = createTokenFromJson();%0A        assertEquals(%22access_token%22, token.access_token);%0A        assertEquals(%22refresh_token%22, token.refresh_token);%0A        assertEquals(%22bearer%22, token.token_type);%0A        assertEquals(%22scope%22, token.scope);%0A        assertEquals(2000, (long) token.expires_in);%0A    %7D%0A%0A    @Test%0A    public void errorCheck() throws Exception %7B%0A        OAuthError error = createErrorFromJson();%0A        assertEquals(%22unauthorized_client%22, error.getError());%0A        assertEquals(%22Invalid client or doesn't have the permission to make this request.%22, error.getErrorDescription());%0A        assertEquals(null, error.getErrorUri());%0A        assertEquals(null, error.getErrorException());%0A    %7D
 %0A%7D

Add some initial tests