package openfoodfacts.github.scrachx.openfood.models;

import org.junit.Test;

import java.io.IOException;
import java.util.List;

import openfoodfacts.github.scrachx.openfood.utils.JsonUtils;

import static org.junit.Assert.assertEquals;

public class AllergenTest {

    @Test
    public void deserialize_json_rest_response() throws IOException {
        String name = "Milk";
        String url = "http://world.openfoodfacts.org/allergen/milk";
        int products = 11376;
        String id = "en:milk";
        AllergenRestResponse restResponse = JsonUtils.readFor(AllergenRestResponse.class)
                .readValue("{\"tags\":[" +
                        "{\"url\":\"" + url + "\"," +
                        "\"products\":" + products + ",\"name\":\"" + name + "\",\"id\":\"" + id + "\"}," +
                        "{\"url\":\"http://world.openfoodfacts.org/allergen/gluten\"," +
                        "\"id\":\"en:gluten\",\"products\":9812,\"name\":\"Gluten\"}" +
                        "]}");

        List<Allergen> allergens = restResponse.getAllergens();
        assertEquals(allergens.size(), 2);
        assertEquals(allergens.get(0).getName(), name);
        assertEquals(allergens.get(0).getProducts(), Integer.valueOf(products));
        assertEquals(allergens.get(0).getUrl(), url);
        assertEquals(allergens.get(0).getIdAllergen(), id);

    }

}
@@ -394,24 +394,25 @@
  url = %22http
+s
 ://world.ope
@@ -838,16 +838,17 @@
 %22:%5C%22http
+s
 ://world
@@ -1375,8 +1375,9 @@
     %7D%0A%0A%7D
+%0A

Migrate to HTTPS for openfood/models/AllergenTest.java