package moe.pine.bottler;

import org.junit.Assert;

import java.net.HttpCookie;

/**
 * Test for SerializableHttpCookie
 * Created by pine on 2017/04/08
 */
public class SerializableHttpCookieTest {
    public void testOf() {
        HttpCookie cookie = new HttpCookie("name", "value");
        cookie.setComment("comment");
        cookie.setCommentURL("commentURL");
        cookie.setDiscard(true);
        cookie.setMaxAge(12345L);
        cookie.setPath("/");
        cookie.setPortlist("443");
        cookie.setSecure(true);
        cookie.setHttpOnly(true);
        cookie.setVersion(10);

        SerializableHttpCookie newCookie = SerializableHttpCookie.of(cookie);
        Assert.assertEquals(cookie.getName(), newCookie.getName());
        Assert.assertEquals(cookie.getValue(), newCookie.getValue());
        Assert.assertEquals(cookie.getDiscard(), newCookie.getDiscard());
        Assert.assertEquals(cookie.getMaxAge(), newCookie.getMaxAge());
        Assert.assertEquals(cookie.getPath(), newCookie.getPath());
        Assert.assertEquals(cookie.getPortlist(), newCookie.getPortlist());
        Assert.assertEquals(cookie.getSecure(), newCookie.getSecure());
        Assert.assertEquals(cookie.isHttpOnly(), newCookie.isHttpOnly());
        Assert.assertEquals(cookie.getVersion(), newCookie.getVersion());
    }
}

@@ -44,16 +44,39 @@
 .Assert;
+%0Aimport org.junit.Test;
 %0A%0Aimport
@@ -216,16 +216,26 @@
 eTest %7B%0A
+    @Test%0A
     publ
@@ -620,17 +620,16 @@
 ersion(1
-0
 );%0A%0A    
@@ -1272,24 +1272,24 @@
 ttpOnly());%0A
-
         Asse
@@ -1355,11 +1355,1606 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testSetName() %7B%0A        SerializableHttpCookie cookie = new SerializableHttpCookie();%0A        Assert.assertNull(cookie.getName());%0A%0A        cookie.setName(%22name%22);%0A        Assert.assertEquals(%22name%22, cookie.getName());%0A    %7D%0A%0A    @Test%0A    public void testSetValue() %7B%0A        SerializableHttpCookie cookie = new SerializableHttpCookie();%0A        Assert.assertNull(cookie.getValue());%0A%0A        cookie.setValue(%22value%22);%0A        Assert.assertEquals(%22value%22, cookie.getValue());%0A    %7D%0A%0A    @Test%0A    public void testSetComment() %7B%0A        SerializableHttpCookie cookie = new SerializableHttpCookie();%0A        Assert.assertNull(cookie.getComment());%0A%0A        cookie.setComment(%22comment%22);%0A        Assert.assertEquals(%22comment%22, cookie.getComment());%0A    %7D%0A%0A    @Test%0A    public void testSetCommentURL() %7B%0A        SerializableHttpCookie cookie = new SerializableHttpCookie();%0A        Assert.assertNull(cookie.getCommentURL());%0A%0A        cookie.setCommentURL(%22commentURL%22);%0A        Assert.assertEquals(%22commentURL%22, cookie.getCommentURL());%0A    %7D%0A%0A    @Test%0A    public void testSetDiscard() %7B%0A        SerializableHttpCookie cookie = new SerializableHttpCookie();%0A        Assert.assertFalse(cookie.getDiscard());%0A%0A        cookie.setDiscard(true);%0A        Assert.assertEquals(true, cookie.getDiscard());%0A    %7D%0A%0A    @Test%0A    public void testSetMaxAge() %7B%0A        SerializableHttpCookie cookie = new SerializableHttpCookie();%0A        Assert.assertEquals(-1, cookie.getMaxAge());%0A%0A        cookie.setMaxAge(12345L);%0A        Assert.assertEquals(12345L, cookie.getMaxAge());%0A    %7D
 %0A%7D%0A

add tests