@Test
public void testCookiesSettingWithTime_ShouldSetDiscard()
        throws InvalidArgumentException, CookieSettingException, ReadValueException {

    FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    CookiesSetter setter = new CookiesSetter();
    IObject environment = new DSObject("{\n" +
            "  \"context\": {\n" +
            "    \"cookies\": [\n" +
            "      {\n" +
            "        \"name\": \"foo\", " +
            "        \"value\": \"bar\",\n" +
            "         \"maxAge\": 12 \n" +
            "      },\n" +
            "      {\n" +
            "        \"name\": \"hello\",  " +
            "        \"value\": \"world\"\n" +
            "      }\n" +
            "    ]\n" +
            "  }\n" +
            "}");
    IObject context = new DSObject(
            " {" +
                    "    \"cookies\": [\n" +
                    "      {\n" +
                    "        \"name\": \"foo\", " +
                    "        \"value\": \"bar\",\n" +
                    "         \"maxAge\": 12 \n" +
                    "      },\n" +
                    "      {\n" +
                    "        \"name\": \"hello\",  " +
                    "        \"value\": \"world\"\n" +
                    "      }\n" +
                    "    ]\n" +
                    "  }\n");
    IObject cookie1 = new DSObject("{\n" +
            "        \"name\": \"foo\", " +
            "        \"value\": \"bar\",\n" +
            "         \"maxAge\": 12 \n" +
            "      }");
    IObject cookie2 = new DSObject("{\n" +
            "        \"name\": \"hello\", " +
            "        \"value\": \"world\"\n" +
            "      }");
    List<IObject> cookies = new ArrayList<>(2);
    cookies.add(cookie1);
    cookies.add(cookie2);
    when(field.in(environment, IObject.class)).thenReturn(context);
    when(field.in(context, List.class)).thenReturn(cookies);
    setter.set(response, environment);
    List<String> cookiesString = response.headers().getAll(HttpHeaders.Names.SET_COOKIE);
    assertTrue(cookiesString.get(0).lastIndexOf("Expires")>0);
    assertFalse(cookiesString.get(1).lastIndexOf("Expires")>0);
}