package com.mgaetan89.showsrage.network;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(Parameterized.class)
public class SickRageApi_GetCredentialsTest {
	@Parameterized.Parameter(3)
	public String credentials;

	@Parameterized.Parameter(2)
	public String password;

	@Parameterized.Parameter(0)
	public boolean useBasicAuthentication;

	@Parameterized.Parameter(1)
	public String username;

	@Test
	public void getCredentials() {
		assertThat(SickRageApi.getCredentials(this.useBasicAuthentication, this.username, this.password)).isEqualTo(this.credentials);
	}

	@Parameterized.Parameters(name = "{index}: {0} [{1}:{2}]")
	public static Collection<Object[]> data() {
		return Arrays.asList(new Object[][]{
				{false, null, null, null},
				{false, null, "", null},
				{false, null, "password", null},
				{false, "", "password", null},
				{false, "username", "password", null},
				{true, null, null, null},
				{true, null, "", null},
				{true, null, "password", null},
				{true, "", "password", null},
				{true, "username", "password", "Basic dXNlcm5hbWU6cGFzc3dvcmQ="},
		});
	}
}

@@ -1043,32 +1043,104 @@
 ssword%22, null%7D,%0A
+%09%09%09%09%7Bfalse, %22username%22, %22%22, null%7D,%0A%09%09%09%09%7Bfalse, %22username%22, null, null%7D,%0A
 %09%09%09%09%7Btrue, null,
@@ -1321,16 +1321,86 @@
 cmQ=%22%7D,%0A
+%09%09%09%09%7Btrue, %22username%22, %22%22, null%7D,%0A%09%09%09%09%7Btrue, %22username%22, null, null%7D,%0A
 %09%09%7D);%0A%09%7D

Add tests