Minimise stubs

By removing all business logic from the stubs, we better test that our analysis treats them as opaque and does not rely on their internal structure
This commit is contained in:
Chris Smowton
2021-04-13 10:28:15 +01:00
parent 45e1a61d7b
commit f22b11881e
2 changed files with 8 additions and 40 deletions

View File

@@ -56,11 +56,6 @@ public class Cookie {
* Cookies using the default version correspond to RFC 2109.
*/
public static final int DEFAULT_VERSION = 1;
private final String name;
private final String value;
private final int version;
private final String path;
private final String domain;
/**
* Create a new instance.
@@ -74,11 +69,6 @@ public class Cookie {
*/
public Cookie(final String name, final String value, final String path, final String domain, final int version)
throws IllegalArgumentException {
this.name = name;
this.value = value;
this.version = version;
this.domain = domain;
this.path = path;
}
/**
@@ -92,7 +82,6 @@ public class Cookie {
*/
public Cookie(final String name, final String value, final String path, final String domain)
throws IllegalArgumentException {
this(name, value, path, domain, DEFAULT_VERSION);
}
/**
@@ -104,7 +93,6 @@ public class Cookie {
*/
public Cookie(final String name, final String value)
throws IllegalArgumentException {
this(name, value, null, null);
}
/**

View File

@@ -57,12 +57,6 @@ public class NewCookie extends Cookie {
*/
public static final int DEFAULT_MAX_AGE = -1;
private final String comment;
private final int maxAge;
private final Date expiry;
private final boolean secure;
private final boolean httpOnly;
/**
* Create a new instance.
*
@@ -71,7 +65,7 @@ public class NewCookie extends Cookie {
* @throws IllegalArgumentException if name is {@code null}.
*/
public NewCookie(String name, String value) {
this(name, value, null, null, DEFAULT_VERSION, null, DEFAULT_MAX_AGE, null, false, false);
super("", "");
}
/**
@@ -93,7 +87,7 @@ public class NewCookie extends Cookie {
String comment,
int maxAge,
boolean secure) {
this(name, value, path, domain, DEFAULT_VERSION, comment, maxAge, null, secure, false);
super("", "");
}
/**
@@ -118,7 +112,7 @@ public class NewCookie extends Cookie {
int maxAge,
boolean secure,
boolean httpOnly) {
this(name, value, path, domain, DEFAULT_VERSION, comment, maxAge, null, secure, httpOnly);
super("", "");
}
/**
@@ -142,7 +136,7 @@ public class NewCookie extends Cookie {
String comment,
int maxAge,
boolean secure) {
this(name, value, path, domain, version, comment, maxAge, null, secure, false);
super("", "");
}
/**
@@ -171,12 +165,7 @@ public class NewCookie extends Cookie {
Date expiry,
boolean secure,
boolean httpOnly) {
super(name, value, path, domain, version);
this.comment = comment;
this.maxAge = maxAge;
this.expiry = expiry;
this.secure = secure;
this.httpOnly = httpOnly;
super("", "");
}
/**
@@ -186,7 +175,7 @@ public class NewCookie extends Cookie {
* @throws IllegalArgumentException if cookie is {@code null}.
*/
public NewCookie(Cookie cookie) {
this(cookie, null, DEFAULT_MAX_AGE, null, false, false);
super("", "");
}
/**
@@ -199,7 +188,7 @@ public class NewCookie extends Cookie {
* @throws IllegalArgumentException if cookie is {@code null}.
*/
public NewCookie(Cookie cookie, String comment, int maxAge, boolean secure) {
this(cookie, comment, maxAge, null, secure, false);
super("", "");
}
/**
@@ -215,16 +204,7 @@ public class NewCookie extends Cookie {
* @since 2.0
*/
public NewCookie(Cookie cookie, String comment, int maxAge, Date expiry, boolean secure, boolean httpOnly) {
super(cookie == null ? null : cookie.getName(),
cookie == null ? null : cookie.getValue(),
cookie == null ? null : cookie.getPath(),
cookie == null ? null : cookie.getDomain(),
cookie == null ? Cookie.DEFAULT_VERSION : cookie.getVersion());
this.comment = comment;
this.maxAge = maxAge;
this.expiry = expiry;
this.secure = secure;
this.httpOnly = httpOnly;
super("", "");
}
/**