blob: 3439dc172eec4ebb608b42f3e9419516e82b9102 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.filter;
import com.yahoo.jdisc.http.Cookie;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
@SuppressWarnings("deprecation")
public class JDiscCookieWrapperTest {
@Test
public void requireThatWrapWorks() {
Cookie cookie = new Cookie("name", "value");
JDiscCookieWrapper wrapper = JDiscCookieWrapper.wrap(cookie);
wrapper.setComment("comment");
wrapper.setDomain("yahoo.com");
wrapper.setMaxAge(10);
wrapper.setPath("/path");
wrapper.setVersion(1);
Assert.assertEquals(wrapper.getName(), cookie.getName());
Assert.assertEquals(wrapper.getValue(), cookie.getValue());
Assert.assertEquals(wrapper.getDomain(), cookie.getDomain());
Assert.assertEquals(wrapper.getComment(), cookie.getComment());
Assert.assertEquals(wrapper.getMaxAge(), cookie.getMaxAge(TimeUnit.SECONDS));
Assert.assertEquals(wrapper.getPath(), cookie.getPath());
Assert.assertEquals(wrapper.getVersion(), cookie.getVersion());
Assert.assertEquals(wrapper.getSecure(), cookie.isSecure());
}
}
|