package com.navercorp.utilset.ui;

import static org.junit.Assert.assertFalse;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLog;

import android.content.Context;

/**
 *
 * @author jaemin.woo
 * 
 */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class ActivityUtilsTest {
	private Context context;
	private static final String NON_EXISTENT_INSTALLED_PACKAGE = "seventh.son.of.a.seventh.son";

	@Before
	public void setUp() {
		ShadowLog.stream = System.out;
		this.context = Robolectric.application;
	}

	@Test
	public void shouldNotReturnTrueForNonExistentInstalledPackage() {
		assertFalse(ActivityUtils.isPackageInstalled(context,
				NON_EXISTENT_INSTALLED_PACKAGE));
	}
}
@@ -50,32 +50,91 @@
 org.
-junit.Assert.assertFalse
+hamcrest.CoreMatchers.*;%0Aimport static org.junit.Assert.*;%0A%0Aimport java.util.Arrays
 ;%0A%0Ai
@@ -378,13 +378,193 @@
 adow
-Log;%0A
+ActivityManager;%0Aimport org.robolectric.shadows.ShadowLog;%0A%0Aimport android.app.ActivityManager;%0Aimport android.app.ActivityManager.RunningTaskInfo;%0Aimport android.content.ComponentName;
 %0Aimp
@@ -625,16 +625,37 @@
 .woo%0A * 
+@author sanghyuk.jung
 %0A */%0A@Ru
@@ -873,16 +873,94 @@
 th.son%22;
+%0A%09private static final String BASE_ACTIVITY_PACKAGE = %22com.navercorp.utilset%22;
 %0A%0A%09@Befo
@@ -1235,9 +1235,618 @@
 E));%0A%09%7D%0A
+%09%0A%09@Test%0A%09public void shouldGetBaseActivityPakcageName() %7B%0A%09%09setBaseActivityPackage(BASE_ACTIVITY_PACKAGE);%0A%09%09String packageName = ActivityUtils.getBaseActivityPackageName(context);%0A%09%09assertThat(packageName, is(BASE_ACTIVITY_PACKAGE));%0A%09%7D%0A%09%0A%09private void setBaseActivityPackage(String packageName) %7B%0A%09%09ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);%0A%09%09ShadowActivityManager shadowAm = Robolectric.shadowOf(am);%0A%09%09RunningTaskInfo info = new RunningTaskInfo();%0A%09%09info.baseActivity = new ComponentName(packageName, %22test%22);%0A%09%09shadowAm.setTasks(Arrays.asList(info));%0A%09%7D%0A
 %7D

Add a test for ActivityUtils.getBaseActivityPackageName()