Search in sources :

Example 6 with Lang

use of com.vaadin.flow.component.charts.model.Lang in project flow-components by vaadin.

the class ChartOptionsJSONSerializationTest method toJSON_LangWithFinnishLocale_LocaleSerialized_ShortMonths.

@Test
public void toJSON_LangWithFinnishLocale_LocaleSerialized_ShortMonths() throws IOException {
    final String[] fiShortMonths = new String[] { "Tammi", "Helmi", "Maalis", "Huhti", "Touko", "Kesä", "Heinä", "Elo", "Syys", "Loka", "Marras", "Joulu" };
    final Lang fi = new Lang();
    fi.setShortMonths(fiShortMonths);
    options.setLang(fi);
    String json = toJSON(options);
    ObjectMapper om = ChartSerialization.createObjectMapper();
    ChartOptions fromJson = om.readValue(json, ChartOptions.class);
    Assert.assertArrayEquals(fiShortMonths, fromJson.getLang().getShortMonths());
}
Also used : Lang(com.vaadin.flow.component.charts.model.Lang) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

Lang (com.vaadin.flow.component.charts.model.Lang)6 Test (org.junit.Test)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Configuration (com.vaadin.flow.component.charts.model.Configuration)2 Chart (com.vaadin.flow.component.charts.Chart)1 ListSeries (com.vaadin.flow.component.charts.model.ListSeries)1 PlotOptionsSeries (com.vaadin.flow.component.charts.model.PlotOptionsSeries)1 Tooltip (com.vaadin.flow.component.charts.model.Tooltip)1 XAxis (com.vaadin.flow.component.charts.model.XAxis)1 YAxis (com.vaadin.flow.component.charts.model.YAxis)1 LumoDarkTheme (com.vaadin.flow.component.charts.themes.LumoDarkTheme)1 LumoLightTheme (com.vaadin.flow.component.charts.themes.LumoLightTheme)1 NativeButton (com.vaadin.flow.component.html.NativeButton)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1