-
Notifications
You must be signed in to change notification settings - Fork 21
Initial implementation #1
Conversation
By keeping the test classes in the same package I can reference a field with protected or default visibility that is not available publicly. In this case it is useful to test only the public APIs to ensure all relevant classes are available, nothing else.
I am going to assume every public API can be nullable
It was allowing only to set a given "defaults" instance but in this case we need to allow changing the current defaults properties instead.
To be consistent with js-cookie behavior.
To make it consistent with js-cookie behavior.
|
Can't use the In this case I believe the solution will be using Additional resources: Also, probably need to find a way to workaround the following condition inside the Servlet Cookie internals from JBoss 7.2.0.Final It declares special characters... static {
if (Boolean.valueOf(System.getProperty("org.glassfish.web.rfc2109_cookie_names_enforced", "true"))) {
TSPECIALS = "/()<>@,;:\\\"[]?={} \t";
} else {
TSPECIALS = ",; ";
}
}It verifies if the given string contains a special character... /*
* Tests a string and returns true if the string counts as a
* reserved token in the Java language.
*
* @param value the <code>String</code> to be tested
*
* @return <code>true</code> if the <code>String</code> is a reserved
* token; <code>false</code> otherwise
*/
private boolean isToken(String value) {
int len = value.length();
for (int i = 0; i < len; i++) {
char c = value.charAt(i);
if (c < 0x20 || c >= 0x7f || TSPECIALS.indexOf(c) != -1) {
return false;
}
}
return true;
}It throws an error if the cookie-name contains special characters upon instantiation... /**
* Constructs a cookie with the specified name and value.
*
* <p>The name must conform to RFC 2109. However, vendors may
* provide a configuration option that allows cookie names conforming
* to the original Netscape Cookie Specification to be accepted.
*
* <p>The name of a cookie cannot be changed once the cookie has
* been created.
*
* <p>The value can be anything the server chooses to send. Its
* value is probably of interest only to the server. The cookie's
* value can be changed after creation with the
* <code>setValue</code> method.
*
* <p>By default, cookies are created according to the Netscape
* cookie specification. The version can be changed with the
* <code>setVersion</code> method.
*
* @param name the name of the cookie
*
* @param value the value of the cookie
*
* @throws IllegalArgumentException if the cookie name is null or
* empty or contains any illegal characters (for example, a comma,
* space, or semicolon) or matches a token reserved for use by the
* cookie protocol
*
* @see #setValue
* @see #setVersion
*/
public Cookie(String name, String value) {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException(
lStrings.getString("err.cookie_name_blank"));
}
if (!isToken(name) ||
name.equalsIgnoreCase("Comment") || // rfc2019
name.equalsIgnoreCase("Discard") || // 2019++
name.equalsIgnoreCase("Domain") ||
name.equalsIgnoreCase("Expires") || // (old cookies)
name.equalsIgnoreCase("Max-Age") || // rfc2019
name.equalsIgnoreCase("Path") ||
name.equalsIgnoreCase("Secure") ||
name.equalsIgnoreCase("Version") ||
name.startsWith("$")) {
String errMsg = lStrings.getString("err.cookie_name_is_token");
Object[] errArgs = new Object[1];
errArgs[0] = name;
errMsg = MessageFormat.format(errMsg, errArgs);
throw new IllegalArgumentException(errMsg);
}
this.name = name;
this.value = value;
} |
With this all encoding tests pass for js-cookie, ;D
Let's use the Firefox driver instead of HTMLUnit, the HTMLUnit is not working properly. I am going to implement it later if necessary.
|
I removed the usage of |
Initial implementation
/window.global_test_resultsnot working for the integration test