package com.uwetrottmann.thetvdb.services;

import com.uwetrottmann.thetvdb.BaseTestCase;
import com.uwetrottmann.thetvdb.entities.LoginData;
import com.uwetrottmann.thetvdb.entities.Token;
import org.junit.Ignore;
import org.junit.Test;

public class AuthenticationTest extends BaseTestCase {


    private static final String API_KEY = "";

    @Ignore
    @Test
    public void test_login() {
        if (API_KEY.length() == 0) {
            throw new IllegalArgumentException("Set your TheTVDB API key to test login.");
        }

        Token token = getTheTvdb().authentication().login(new LoginData(API_KEY));
        System.out.println("Retrieved token: " + token.token + " (valid for 1 hour)");
    }

    @Ignore
    @Test
    public void test_refreshToken() {
        Token token = getTheTvdb().authentication().refreshToken();
        System.out.println("Refreshed token: " + token.token + " (valid for 1 hour)");
    }

}

@@ -204,23 +204,22 @@
 nit.
-Ignore;
+Test;%0A
 %0Aimport 
 org.
@@ -210,37 +210,72 @@
 st;%0A%0Aimport 
-org.junit.Tes
+static org.assertj.core.api.Assertions.assertTha
 t;%0A%0Apublic c
@@ -322,17 +322,16 @@
 Case %7B%0A%0A
-%0A
     priv
@@ -369,28 +369,16 @@
  = %22%22;%0A%0A
-    @Ignore%0A
     @Tes
@@ -528,16 +528,17 @@
 to test 
+/
 login.%22)
@@ -546,24 +546,101 @@
 %0A        %7D%0A%0A
+        // remove existing auth%0A        getTheTvdb().setJsonWebToken(null);%0A%0A
         Toke
@@ -808,20 +808,8 @@
  %7D%0A%0A
-    @Ignore%0A
     
@@ -864,65 +864,539 @@
     
-Token token = getTheTvdb().authentication().refreshToken(
+if (API_KEY.length() == 0) %7B%0A            throw new IllegalArgumentException(%22Set your TheTVDB API key to test /refresh_token.%22);%0A        %7D%0A%0A        // remove existing auth%0A        getTheTvdb().setJsonWebToken(null);%0A%0A        // authenticate with API key%0A        Token token = getTheTvdb().authentication().login(new LoginData(API_KEY));%0A        getTheTvdb().setJsonWebToken(token.token);%0A%0A        Token refreshedToken = getTheTvdb().authentication().refreshToken();%0A        assertThat(refreshedToken.token).isNotEqualTo(token.token
 );%0A 
@@ -1435,33 +1435,42 @@
 shed token: %22 + 
-t
+refreshedT
 oken.token + %22 (

Set up auth tests properly so they can always run.