package io.wovn.wovnjava;

import junit.framework.TestCase;

import java.util.Map;

public class LangTest extends TestCase {

    public void testLangsExist() {
        assertNotNull(Lang.LANG);
    }

    public void testKeyExist() {
        for (Map.Entry<String, Lang> e : Lang.LANG.entrySet()) {
            String k = e.getKey();
            Lang l = e.getValue();
            assertFalse(l.name == null || l.name.length() == 0);
            assertFalse(l.code == null || l.code.length() == 0);
            assertFalse(l.en == null || l.en.length() == 0);
            assertEquals(k, l.code);
        }
    }

    public void testGetCodeWithValidCode() {
        assertEquals("ms", Lang.getCode("ms"));
    }

    public void testGetCodeWithCapitalLetters() {
        assertEquals("zh-CHT", Lang.getCode("zh-cht"));
    }

    public void testGetCodeWithValidEnglishName() {
        assertEquals("pt", Lang.getCode("Portuguese"));
    }

    public void testGetCodeWithValidNativeName() {
        assertEquals("hi", Lang.getCode("हिन्दी"));
    }

    public void testGetCodeWithInvalidName() {
        assertEquals(null, Lang.getCode("WOVN4LYFE"));
    }

    public void testGetCodeWithEmptyString() {
        assertEquals(null, Lang.getCode(""));
    }

    public void testGetCodeWithNull() {
        assertEquals(null, Lang.getCode(null));
    }

}
@@ -1350,9 +1350,797 @@
 %0A    %7D%0A%0A
+    public void testGetLangWithValidCode() %7B%0A        assertSame(Lang.LANG.get(%22ms%22), Lang.getLang(%22ms%22));%0A    %7D%0A%0A    public void testGetLangWithCapitalLetters() %7B%0A        assertSame(Lang.LANG.get(%22zh-CHT%22), Lang.getLang(%22zh-cht%22));%0A    %7D%0A%0A    public void testGetLangWithValidEnglishName() %7B%0A        assertSame(Lang.LANG.get(%22pt%22), Lang.getLang(%22Portuguese%22));%0A    %7D%0A%0A    public void testGetLangWithValidNativeName() %7B%0A        assertSame(Lang.LANG.get(%22hi%22), Lang.getLang(%22%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80%22));%0A    %7D%0A%0A    public void testGetLangWithInvalidName() %7B%0A        assertSame(null, Lang.getLang(%22WOVN4LYFE%22));%0A    %7D%0A%0A    public void testGetLangWithEmptyString() %7B%0A        assertSame(null, Lang.getLang(%22%22));%0A    %7D%0A%0A    public void testGetLangWithNull() %7B%0A        assertSame(null, Lang.getLang(null));%0A    %7D%0A%0A
 %7D

Add tests to LangTest.java.