Cleaned up and updated dependencies
This commit is contained in:
parent
8ed5bc951f
commit
c4edb4fd1f
20 changed files with 80 additions and 803 deletions
|
@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
* Populates the {@link #REASON_PHRASES reason phrases} map from {@link #BUNDLE_BASENAME bundle properties}, and
|
||||
* implements accessor methods.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-02
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.io.Serializable;
|
|||
/**
|
||||
* The <code>StatusCode</code> bean implements methods to check the class of an HTTP status code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
*/
|
||||
public class StatusCode implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.io.Writer;
|
|||
/**
|
||||
* The <code>Utils</code> class implements a collection of utility methods used throughout this project.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* The <code><hs:cause></code> tag returns the cause (if any) for the current HTTP Status Error Code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* The <code><hs:code></code> tag returns the HTTP Status Error Code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* The <code><hs:message></code> tag returns the message (if any) for the current error.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2022-03-16
|
||||
* @since 1.0.5
|
||||
*/
|
||||
|
|
|
@ -43,7 +43,7 @@ import java.io.IOException;
|
|||
* The <code><hs:reason></code> tag returns the Reason Phrase for the current (or specified) HTTP Status Error
|
||||
* Code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-02
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@ import javax.servlet.jsp.tagext.SimpleTagSupport;
|
|||
/**
|
||||
* Adds support for the <code>default</code> and <code>escapeXml</code> tag attributes.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -47,7 +47,7 @@ import static org.testng.Assert.assertTrue;
|
|||
/**
|
||||
* Main Class Tests.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @created 2019-05-06
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ import static org.testng.Assert.assertEquals;
|
|||
/**
|
||||
* Reasons Tests.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ import static org.testng.Assert.*;
|
|||
/**
|
||||
* StatusCode Tests.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
*/
|
||||
@SuppressFBWarnings("CE_CLASS_ENVY")
|
||||
public class StatusCodeTest {
|
||||
|
@ -50,9 +50,8 @@ public class StatusCodeTest {
|
|||
void testStatusCode() {
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
|
||||
StatusCode statusCode = new StatusCode();
|
||||
int code;
|
||||
for (final String key : bundle.keySet()) {
|
||||
code = Integer.parseInt(key);
|
||||
final int code = Integer.parseInt(key);
|
||||
statusCode.setCode(code);
|
||||
assertEquals(statusCode.getCode(), code, "is not " + code);
|
||||
assertEquals(statusCode.isInfo(), code >= 100 && code < 200, code + " is info");
|
||||
|
@ -66,15 +65,21 @@ public class StatusCodeTest {
|
|||
assertEquals(statusCode.getReason(), Reasons.getReasonPhrase(code), code + "reason phrase is not valid");
|
||||
}
|
||||
|
||||
code = 600;
|
||||
statusCode = new StatusCode(code);
|
||||
assertEquals(statusCode.getCode(), 600, "is not " + code);
|
||||
assertFalse(statusCode.isInfo(), code + " is info");
|
||||
assertFalse(statusCode.isSuccess(), code + " is ok");
|
||||
assertFalse(statusCode.isRedirect(), code + " is redirect");
|
||||
assertFalse(statusCode.isClientError(), code + " is client error");
|
||||
assertFalse(statusCode.isServerError(), code + " is server error");
|
||||
assertFalse(statusCode.isError(), code + " is error");
|
||||
assertFalse(statusCode.isValid(), "600 is invalid");
|
||||
final int[] unknowns = {0, 99, 600};
|
||||
for (final int code : unknowns) {
|
||||
statusCode.setCode(code);
|
||||
assertEquals(statusCode.getCode(), code, "is not " + code);
|
||||
assertFalse(statusCode.isInfo(), code + " is info");
|
||||
assertFalse(statusCode.isSuccess(), code + " is ok");
|
||||
assertFalse(statusCode.isRedirect(), code + " is redirect");
|
||||
assertFalse(statusCode.isClientError(), code + " is client error");
|
||||
assertFalse(statusCode.isServerError(), code + " is server error");
|
||||
assertFalse(statusCode.isError(), code + " is error");
|
||||
assertFalse(statusCode.isValid(), "600 is invalid");
|
||||
assertNull(statusCode.getReason(), code + "reason phrase is not null.");
|
||||
}
|
||||
|
||||
statusCode = new StatusCode(900);
|
||||
assertEquals(statusCode.getCode(), 900, "is not 900");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import static org.testng.Assert.assertEquals;
|
|||
/**
|
||||
* Utils Tests.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net" target="_blank">Erik C. Thauvin</a>
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue