package io.github.droidkaigi.confsched.util;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

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

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

@RunWith(AndroidJUnit4.class)
public class AppUtilsTest {

    @Test
    public void testTwitterUrl() throws Exception {
        assertThat(AppUtil.getTwitterUrl("konifar")).isEqualTo("https://twitter.com/konifar");
    }

    @Test
    public void testGitHubUrl() throws Exception {
        assertThat(AppUtil.getGitHubUrl("konifar")).isEqualTo("https://github.com/konifar");
    }

    @Test
    public void testCurrentLanguageId() throws Exception {
        Context context = InstrumentationRegistry.getContext();
        // AppUtil.getCurrentLanguageId does not return empty or null value.
        assertThat(AppUtil.getCurrentLanguageId(context)).isNotNull().isNotEmpty();
    }
}

@@ -232,16 +232,67 @@
 nWith;%0A%0A
+import java.util.Arrays;%0Aimport java.util.Locale;%0A%0A
 import s
@@ -341,16 +341,16 @@
 rtThat;%0A
-
 %0A@RunWit
@@ -874,157 +874,883 @@
  // 
-AppUtil.getCurrentLanguageId does not return empty or null value.%0A        assertThat(AppUtil.getCurrentLanguageId(context)).isNotNull().isNotEmpty();
+is not null value.%0A        assertThat(AppUtil.getCurrentLanguageId(context)).isNotNull();%0A%0A        PrefUtil.put(context, PrefUtil.KEY_CURRENT_LANGUAGE_ID, %22ja%22);%0A        // eq to languageID is put in SharedPreferences.%0A        assertThat(AppUtil.getCurrentLanguageId(context)).isEqualTo(%22ja%22);%0A%0A        PrefUtil.remove(context, PrefUtil.KEY_CURRENT_LANGUAGE_ID);%0A        String defaultLanguage = Locale.getDefault().getLanguage().toLowerCase();%0A        if (Arrays.asList(AppUtil.SUPPORT_LANG).contains(defaultLanguage)) %7B%0A            // eq to Locale.getDefault().getLanguage() when it is supported%0A            assertThat(AppUtil.getCurrentLanguageId(context)).isEqualTo(defaultLanguage);%0A        %7D else %7B%0A            // eq to %22en%22 when Locale.getDefault().getLanguage() is not supported%0A            assertThat(AppUtil.getCurrentLanguageId(context)).isEqualTo(%22en%22);%0A        %7D
 %0A   

Fix getCurrentLanguageId test