package com.growthbeat;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;

import com.growthbeat.model.Account;
import com.growthbeat.model.Application;
import com.growthbeat.model.Client;
import com.growthbeat.model.Connection;
import com.growthbeat.model.Credential;
import com.growthbeat.model.Session;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BaseTest {

	protected static final String BASE_URL = "http://api.growthbeat.com/";
	protected static final String CREDENTIAL_ID = "wXvp0nuo3SmR5zMDAtuoKMxElgUgN968";
	protected static final String SERVICE_ID = "5FjbhqsIHTGdfVeP";

	protected static Account testAccount = null;
	protected static Credential testCredential = null;
	protected static Application testApplication = null;
	protected static Client testClient = null;
	protected static Connection testConnection = null;
	protected static Session testSession = null;

	protected Growthbeat growthbeat = null;

	@BeforeClass
	public static void a1BeforeClass() {
		if (testAccount == null)
			init();
	}

	@Before
	public void a2Before() {
		growthbeat = createGrowthbeat(testCredential.getId());
	}

	private static void init() {

		Growthbeat parentGrowthbeat = createGrowthbeat(CREDENTIAL_ID);

		testAccount = parentGrowthbeat.createAccount();
		testCredential = parentGrowthbeat.createCredential(testAccount.getId());

		Growthbeat childGrowthbeat = createGrowthbeat(testCredential.getId());

		testApplication = childGrowthbeat.createApplication("Java SDK");
		testClient = childGrowthbeat.createClient(testApplication.getId());
		testConnection = childGrowthbeat.createConnection(testAccount.getId(), SERVICE_ID);
		testSession = childGrowthbeat.createSession(testAccount.getId(), SERVICE_ID);

	}

	protected static Growthbeat createGrowthbeat(String credentialId) {
		Growthbeat growthbeat = new Growthbeat(credentialId);
		growthbeat.getContext().getGrowthbeatHttpClient().setBaseUrl(BASE_URL);
		return growthbeat;
	}

}

@@ -454,80 +454,8 @@
  %7B%0A%0A
-%09protected static final String BASE_URL = %22http://api.growthbeat.com/%22;%0A
 %09pro
@@ -1801,39 +1801,22 @@
 Id) %7B%0A%09%09
-Growthbeat growthbeat =
+return
  new Gro
@@ -1842,103 +1842,8 @@
 d);%0A
-%09%09growthbeat.getContext().getGrowthbeatHttpClient().setBaseUrl(BASE_URL);%0A%09%09return growthbeat;%0A
 %09%7D%0A%0A

Modify endpoint of url for tests