Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit 39bcc47

Browse files
Fix some visibility issues to comply with the docs
1 parent a0d12aa commit 39bcc47

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/main/java/org/jscookie/ConverterStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.jscookie;
22

3-
interface ConverterStrategy {
3+
public interface ConverterStrategy {
44
/**
55
* Apply the decoding strategy of a cookie. The return will be used as the cookie value
66
*

src/main/java/org/jscookie/CookieParseException.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package org.jscookie;
22

3-
public class CookieParseException extends Exception {
3+
public final class CookieParseException extends Exception {
44
private static final long serialVersionUID = 1;
5+
@SuppressWarnings( "unused" )
6+
private CookieParseException() {}
57
CookieParseException( Throwable cause ) {
68
super( cause );
79
}

src/main/java/org/jscookie/CookieSerializationException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
public class CookieSerializationException extends Exception {
44
private static final long serialVersionUID = 1;
5+
@SuppressWarnings( "unused" )
6+
private CookieSerializationException() {}
57
CookieSerializationException( Throwable cause ) {
68
super( cause );
79
}

src/test/java/org/jscookie/test/unit/CookiesConverterTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import javax.script.ScriptException;
66

77
import org.jscookie.ConverterException;
8+
import org.jscookie.ConverterStrategy;
89
import org.jscookie.Cookies;
910
import org.jscookie.test.unit.utils.BaseTest;
1011
import org.junit.Assert;
@@ -51,4 +52,16 @@ public String convert( String value, String name ) throws ConverterException {
5152
expected = "京";
5253
Assert.assertEquals( expected, actual );
5354
}
55+
56+
@Test
57+
public void should_be_able_to_create_a_custom_strategy() {
58+
this.cookies.withConverter( new CustomConverter() );
59+
}
60+
61+
private class CustomConverter implements ConverterStrategy {
62+
@Override
63+
public String convert( String value, String name ) throws ConverterException {
64+
return value;
65+
}
66+
}
5467
}

0 commit comments

Comments
 (0)