package io.wovn.wovnjava;

import junit.framework.TestCase;

import java.util.List;

public class ValuesTest extends TestCase {

    private static final String JSON
        = "{"
            + "\"text_vals\":{"
                + "\"Orders\":{"
                    + "\"ja\":["
                        + "{"
                            + "\"xpath\":\"/html/body/div/div/ul/li[4]/ul/li[5]/a/text()\","
                            + "\"data\":\"オーダー\""
                        + "}"
                    + "]"
                + "},"
                + "\"Copyright\":{"
                    + "\"\":["
                        + "{"
                            + "\"xpath\":\"\","
                            + "\"data\":\"\""
                        + "}"
                    + "]"
                + "}"
            + "},"
            + "\"img_vals\":{"
                + "\"https://wovn.io/assets/header_logo.png\":{"
                    + "\"en\":["
                        + "{"
                            + "\"xpath\":\"/html/body/div/a/img\","
                            + "\"data\":\"https://s3-us-west-1.amazonaws.com/st.wovn.io/logo_en.png\""
                        + "}"
                    + "]"
                + "}"
            + "},"
            + "\"layout_vals\":{"
            + "}"
        + "}";

    public void testGetLangs() {
        Values values = new Values(JSON);
        List<String> langs = values.getLangs();
        assertEquals(2, langs.size());
        assertEquals("en", langs.get(0));
        assertEquals("ja", langs.get(1));
    }

    public void testGetTextExists() {
        Values values = new Values(JSON);
        String text = values.getText("Orders", "ja");
        assertEquals("オーダー", text);
    }

    public void testGetTextNotExists() {
        Values values = new Values(JSON);
        String text = values.getText("Non existing text", "ja");
        assertEquals(null, text);
    }

    public void testGetImage() {
        Values values = new Values(JSON);
        String image = values.getImage("https://wovn.io/assets/header_logo.png", "en");
        assertEquals("https://s3-us-west-1.amazonaws.com/st.wovn.io/logo_en.png", image);
    }
}
@@ -762,32 +762,300 @@
           + %22%5D%22%0A
+                + %22%7D,%22%0A                + %22%5C%22Blank%5C%22:%7B%22%0A                    + %22%5C%22ja%5C%22:%5B%22%0A                        + %22%7B%22%0A                            + %22%5C%22xpath%5C%22:%5C%22%5C%22,%22%0A                            + %22%5C%22data%5C%22:%5C%22%5C%22%22%0A                        + %22%7D%22%0A                    + %22%5D%22%0A
                 
@@ -2185,32 +2185,203 @@
 , text);%0A    %7D%0A%0A
+    public void testGetTextBlank() %7B%0A        Values values = new Values(JSON);%0A        String text = values.getText(%22Blank%22, %22ja%22);%0A        assertEquals(%22%22, text);%0A    %7D%0A%0A
     public void 

Add test.