Code format, tabs to space, etc.

This commit is contained in:
Erik C. Thauvin 2016-07-18 18:17:22 -07:00
parent c707b342aa
commit 32a1bf3875
13 changed files with 588 additions and 516 deletions

View file

@ -1,12 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="httpstatus" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4"> <module external.linked.project.id="httpstatus" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../build/classes/main" />
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$/../.."> <content url="file://$MODULE_DIR$/../..">
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" /> <excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
<excludeFolder url="file://$MODULE_DIR$/../../build" /> <excludeFolder url="file://$MODULE_DIR$/../../build" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.testng:testng:6.9.12" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.beust:jcommander:1.48" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant:1.7.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant-launcher:1.7.0" level="project" />
</component> </component>
</module> </module>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="httpstatus:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../build/classes/main" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/main">
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2" level="project" />
</component>
</module>

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="httpstatus:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/test">
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="httpstatus_main" />
<orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2" level="project" />
<orderEntry type="library" name="Gradle: org.testng:testng:6.9.12" level="project" />
<orderEntry type="library" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
<orderEntry type="library" name="Gradle: com.beust:jcommander:1.48" level="project" />
<orderEntry type="library" name="Gradle: org.apache.ant:ant:1.7.0" level="project" />
<orderEntry type="library" name="Gradle: org.apache.ant:ant-launcher:1.7.0" level="project" />
</component>
<component name="TestModuleProperties" production-module="httpstatus_main" />
</module>

View file

@ -57,10 +57,6 @@
<processorPath useClasspath="true" /> <processorPath useClasspath="true" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel>
<module name="httpstatus_main" target="1.8" />
<module name="httpstatus_test" target="1.8" />
</bytecodeTargetLevel>
</component> </component>
<component name="CopyrightManager" default=""> <component name="CopyrightManager" default="">
<copyright> <copyright>
@ -75,7 +71,7 @@
</LanguageOptions> </LanguageOptions>
</component> </component>
<component name="DependencyValidationManager"> <component name="DependencyValidationManager">
<scope name="Source" pattern="file[httpstatus]:src/main/java//*.java" /> <scope name="Source" pattern="file[httpstatus]:src/main/java//*.java||file[httpstatus]:src/test/java//*.java" />
</component> </component>
<component name="Encoding"> <component name="Encoding">
<file url="PROJECT" charset="UTF-8" /> <file url="PROJECT" charset="UTF-8" />
@ -83,12 +79,35 @@
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<entry_points version="2.0" /> <entry_points version="2.0" />
</component> </component>
<component name="GradleLocalSettings">
<option name="modificationStamps">
<map>
<entry key="K:/GitHub/CompileOnlyPlugin" value="2933943731758" />
<entry key="K:/ect/groovy/SshotCleaner" value="2892856534549" />
<entry key="K:/ect/java/Captcha" value="2894636758390" />
<entry key="K:/ect/java/FileSplitter" value="2846829504112" />
<entry key="K:/ect/java/GZIPFilter" value="2894567636586" />
<entry key="K:/ect/java/Lotto" value="2894619520256" />
<entry key="K:/ect/java/SshotCleaner" value="1446415498070" />
<entry key="K:/ect/java/TorrentCleaner" value="2894593616839" />
<entry key="K:/ect/java/click" value="2894595659515" />
<entry key="K:/ect/java/iFit2Workout" value="2894645931218" />
<entry key="K:/imacination/jtalk" value="2865986493991" />
<entry key="$PROJECT_DIR$/../DataProviderTest" value="2935655621669" />
<entry key="$PROJECT_DIR$" value="2921271906937" />
<entry key="$PROJECT_DIR$/../SemanticVersion" value="2905451385982" />
<entry key="$PROJECT_DIR$/../mobibot" value="2865248599040" />
<entry key="$PROJECT_DIR$/../semver" value="2921872379706" />
</map>
</option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="createEmptyContentRootDirectories" value="true" /> <option name="distributionType" value="LOCAL" />
<option name="disableWrapperSourceDistributionNotification" value="true" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:/gradle" /> <option name="gradleHome" value="C:/gradle" />
<option name="gradleJvm" value="#JAVA_HOME" /> <option name="gradleJvm" value="#JAVA_HOME" />
@ -97,6 +116,7 @@
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
</set> </set>
</option> </option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useAutoImport" value="true" /> <option name="useAutoImport" value="true" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
@ -157,6 +177,33 @@
<option name="USE_PROJECT_PROFILE" value="true" /> <option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" /> <version value="1.0" />
</component> </component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>Android Lint</id>
</State>
<State>
<id>Java</id>
</State>
<State>
<id>Portability issuesJava</id>
</State>
</expanded-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" /> <OptionsSetting value="true" id="Remove" />
@ -170,15 +217,110 @@
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus_main.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus_main.iml" group="httpstatus" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus_test.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus_test.iml" group="httpstatus" />
</modules> </modules>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="PropertiesComponent">
<property name="GoToClass.includeLibraries" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="settings.editor.selected.configurable" value="Errors" />
<property name="settings.editor.splitter.proportion" value="0.2" />
</component>
<component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
</component>
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="Git" />
</component> </component>
<component name="libraryTable"> <component name="libraryTable">
<library name="Gradle: com.beust:jcommander:1.48"> <library name="Gradle: com.beust:jcommander:1.48">
@ -233,7 +375,6 @@
</library> </library>
<library name="Gradle: org.testng:testng:6.9.12"> <library name="Gradle: org.testng:testng:6.9.12">
<CLASSES> <CLASSES>
<root url="jar://$PROJECT_DIR$/Could not find org.testng:testng:6.9.12.&#13;&#10;Searched in the following locations:&#13;&#10; https:/repo1.maven.org/maven2/org/testng/testng/6.9.12/testng-6.9.12.pom&#13;&#10; https:/repo1.maven.org/maven2/org/testng/testng/6.9.12/testng-6.9.12.jar!/" />
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.testng/testng/6.9.12/354eba9b34737190bad0a72dd5671683cfbae24d/testng-6.9.12.jar!/" /> <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.testng/testng/6.9.12/354eba9b34737190bad0a72dd5671683cfbae24d/testng-6.9.12.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
@ -242,4 +383,20 @@
</SOURCES> </SOURCES>
</library> </library>
</component> </component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8.x</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.19944212" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project> </project>

View file

@ -1,5 +1,5 @@
plugins { plugins {
id "com.jfrog.bintray" version "1.5" id "com.jfrog.bintray" version "1.5"
} }
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'idea' apply plugin: 'idea'
@ -29,26 +29,26 @@ def pkgIssueTrackerUrl = mavenUrl + '/issues'
def pkgLabels = ['jsp', 'tag library', 'http', 'status code', 'java'] def pkgLabels = ['jsp', 'tag library', 'http', 'status code', 'java']
def getVersion(isIncrement = false) { def getVersion(isIncrement = false) {
def propsFile = 'version.properties' def propsFile = 'version.properties'
def majorKey = 'version.major' def majorKey = 'version.major'
def minorKey = 'version.minor' def minorKey = 'version.minor'
def patchKey = 'version.patch' def patchKey = 'version.patch'
def metaKey = 'version.buildmeta' def metaKey = 'version.buildmeta'
def preKey = 'version.prerelease' def preKey = 'version.prerelease'
if (isIncrement) { if (isIncrement) {
ant.propertyfile(file: propsFile) { ant.propertyfile(file: propsFile) {
entry(key: patchKey, entry(key: patchKey,
type: 'int', type: 'int',
default: '-1', default: '-1',
operation: '+') operation: '+')
} }
} }
def p = new Properties() def p = new Properties()
file(propsFile).withInputStream { stream -> p.load(stream) } file(propsFile).withInputStream { stream -> p.load(stream) }
def metadata = p.getProperty(metaKey, '') def metadata = p.getProperty(metaKey, '')
def prerelease = p.getProperty(preKey, '') def prerelease = p.getProperty(preKey, '')
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') + return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : '')) (prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
} }
version = getVersion(); version = getVersion();
@ -57,178 +57,174 @@ mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories { repositories {
mavenLocal() mavenLocal()
jcenter() jcenter()
} }
dependencies { dependencies {
compile 'javax.servlet:javax.servlet-api:3.1.0' compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'javax.servlet.jsp:jsp-api:2.2' compile 'javax.servlet.jsp:jsp-api:2.2'
testCompile 'org.testng:testng:6.9.12' testCompile 'org.testng:testng:6.9.12'
} }
bintray { bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['MyPublication'] publications = ['MyPublication']
dryRun = false dryRun = false
pkg { pkg {
repo = 'maven' repo = 'maven'
name = mavenName name = mavenName
licenses = pkgLicenses licenses = pkgLicenses
desc = mavenDescription desc = mavenDescription
websiteUrl = mavenUrl websiteUrl = mavenUrl
issueTrackerUrl = pkgIssueTrackerUrl issueTrackerUrl = pkgIssueTrackerUrl
vcsUrl = mavenScmCon vcsUrl = mavenScmCon
labels = pkgLabels labels = pkgLabels
publicDownloadNumbers = true publicDownloadNumbers = true
version { version {
name = project.version name = project.version
desc = 'Version ' + project.version desc = 'Version ' + project.version
vcsTag = project.version vcsTag = project.version
gpg { gpg {
sign = true sign = true
} }
} }
} }
} }
def pomConfig = { def pomConfig = {
licenses { licenses {
license { license {
name mavenLicense name mavenLicense
url mavenLicenseUrl url mavenLicenseUrl
distribution 'repo' distribution 'repo'
} }
} }
developers { developers {
developer { developer {
id 'ethauvin' id 'ethauvin'
name 'Erik C. Thauvin' name 'Erik C. Thauvin'
email 'erik@thauvin.net' email 'erik@thauvin.net'
} }
} }
scm { scm {
connection 'scm:git:' + mavenScmCon connection 'scm:git:' + mavenScmCon
developerConnection 'scm:git:' + mavenScmDevCon developerConnection 'scm:git:' + mavenScmDevCon
url mavenScmCon url mavenScmCon
} }
} }
publishing { publishing {
publications { publications {
MyPublication(MavenPublication) { MyPublication(MavenPublication) {
from components.java from components.java
artifact sourcesJar artifact sourcesJar
artifact javadocJar artifact javadocJar
groupId mavenGroupId groupId mavenGroupId
artifactId rootProject.name artifactId rootProject.name
version project.version version project.version
pom.withXml { pom.withXml {
def root = asNode() def root = asNode()
root.appendNode('name', mavenName) root.appendNode('name', mavenName)
root.appendNode('description', mavenDescription) root.appendNode('description', mavenDescription)
root.appendNode('url', mavenUrl) root.appendNode('url', mavenUrl)
root.children().last() + pomConfig root.children().last() + pomConfig
} }
} }
} }
} }
task javadocJar(type: Jar, dependsOn: javadoc) { task javadocJar(type: Jar, dependsOn: javadoc) {
group = 'Build' group = 'Build'
description = 'Builds an archive of the javadoc docs.' description = 'Builds an archive of the javadoc docs.'
classifier = 'javadoc' classifier = 'javadoc'
from javadoc.destinationDir from javadoc.destinationDir
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {
group = 'Build' group = 'Build'
description = 'Builds an archive of the source code.' description = 'Builds an archive of the source code.'
classifier = 'sources' classifier = 'sources'
from sourceSets.main.allSource from sourceSets.main.allSource
} }
artifacts { artifacts {
archives javadocJar archives javadocJar
archives sourcesJar archives sourcesJar
} }
javadoc { javadoc {
title = mavenDescription + ' ' + version title = mavenDescription + ' ' + version
options.tags = ['created'] options.tags = ['created']
options.author = true options.author = true
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/') options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip") options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
if (JavaVersion.current().isJava8Compatible()) if (JavaVersion.current().isJava8Compatible()) {
{ options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('Xdoclint:none', '-quiet') }
}
} }
compileJava { compileJava {
doFirst { doFirst {
project.version = getVersion(isRelease) project.version = getVersion(isRelease)
} }
//options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation' //options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
} }
jar { jar {
manifest.attributes('Main-Class': mainClassName) manifest.attributes('Main-Class': mainClassName)
} }
clean { clean {
delete deployDir delete deployDir
} }
test { test {
useTestNG() useTestNG()
} }
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = gradle.gradleVersion gradleVersion = gradle.gradleVersion
} }
task copyToDeploy(type: Copy) { task copyToDeploy(type: Copy) {
from(configurations.runtime) { from(configurations.runtime) {
exclude 'javax.servlet-api-*.jar' exclude 'javax.servlet-api-*.jar'
exclude 'jsp-api-*.jar' exclude 'jsp-api-*.jar'
} }
from jar from jar
into deployDir into deployDir
} }
task deploy(dependsOn: ['build', 'copyToDeploy']) { task deploy(dependsOn: ['build', 'copyToDeploy']) {
description = 'Copies all needed files to the ${deployDir} directory.' description = 'Copies all needed files to the ${deployDir} directory.'
group = 'Publishing' group = 'Publishing'
outputs.dir deployDir outputs.dir deployDir
inputs.files copyToDeploy inputs.files copyToDeploy
mustRunAfter clean mustRunAfter clean
} }
task release(dependsOn: ['wrapper', 'clean', 'deploy']) << { task release(dependsOn: ['wrapper', 'clean', 'deploy']) << {
group = 'Publishing' group = 'Publishing'
description = 'Releases new version.' description = 'Releases new version.'
isRelease = true isRelease = true
} }
task pandoc(type: Exec) { task pandoc(type: Exec) {
group = 'Documentation' group = 'Documentation'
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md'] def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
if (Os.isFamily(Os.FAMILY_WINDOWS)) if (Os.isFamily(Os.FAMILY_WINDOWS)) {
{ commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args) } else {
} executable 'pandoc'
else args pandoc_args
{ }
executable 'pandoc' standardOutput = new ByteArrayOutputStream()
args pandoc_args ext.output = {
} return standardOutput.toString()
standardOutput = new ByteArrayOutputStream() }
ext.output = {
return standardOutput.toString()
}
} }

View file

@ -43,66 +43,55 @@ import java.util.TreeMap;
* @created 2015-12-02 * @created 2015-12-02
* @since 1.0 * @since 1.0
*/ */
public class Reasons public class Reasons {
{ /**
/** * The resource bundle base name.
* The resource bundle base name. */
*/ public static final String BUNDLE_BASENAME = "net.thauvin.erik.httpstatus.reasons";
public static final String BUNDLE_BASENAME = "net.thauvin.erik.httpstatus.reasons";
/** /**
* The reason phrases map. * The reason phrases map.
*/ */
private static final Map<String, String> REASON_PHRASES = new TreeMap<String, String>(); private static final Map<String, String> REASON_PHRASES = new TreeMap<String, String>();
/** // Initializes the reason phrases map.
* Returns the reason phrase for the specified status code. static {
* final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
* @param statusCode The status code. for (final String key : bundle.keySet()) {
* REASON_PHRASES.put(key, bundle.getString(key));
* @return The reason phrase, or <code>null</code>. }
*/ }
public static String getReasonPhrase(final int statusCode)
{
return getReasonPhrase(Integer.toString(statusCode));
}
/** /**
* Returns the reason phrase for the specified status code. * Returns the reason phrase for the specified status code.
* *
* @param statusCode The status code. * @param statusCode The status code.
* * @return The reason phrase, or <code>null</code>.
* @return The reason phrase, or <code>null</code>. */
*/ public static String getReasonPhrase(final int statusCode) {
public static String getReasonPhrase(final String statusCode) return getReasonPhrase(Integer.toString(statusCode));
{ }
return REASON_PHRASES.get(statusCode);
}
/** /**
* Prints the status codes and reason phrases. * Returns the reason phrase for the specified status code.
* *
* @param args The command line arguments. * @param statusCode The status code.
*/ * @return The reason phrase, or <code>null</code>.
public static void main(final String... args) */
{ public static String getReasonPhrase(final String statusCode) {
for (final Map.Entry<String, String> entry : REASON_PHRASES.entrySet()) return REASON_PHRASES.get(statusCode);
{ }
System.out.println(entry.getKey() + ": " + entry.getValue());
}
System.out.println("Total: " + REASON_PHRASES.entrySet().size()); /**
} * Prints the status codes and reason phrases.
*
* @param args The command line arguments.
*/
public static void main(final String... args) {
for (final Map.Entry<String, String> entry : REASON_PHRASES.entrySet()) {
System.out.println(entry.getKey() + ": " + entry.getValue());
}
/** System.out.println("Total: " + REASON_PHRASES.entrySet().size());
* Initializes the reason phrases map. }
*/
static
{
final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
for (final String key : bundle.keySet())
{
REASON_PHRASES.put(key, bundle.getString(key));
}
}
} }

View file

@ -41,95 +41,78 @@ import java.io.Writer;
* @created 2015-12-03 * @created 2015-12-03
* @since 1.0 * @since 1.0
*/ */
public final class Utils public final class Utils {
{
/** /**
* Disables the default constructor. * Disables the default constructor.
* *
* @throws UnsupportedOperationException If the constructor is called. * @throws UnsupportedOperationException If the constructor is called.
*/ */
private Utils() private Utils()
throws UnsupportedOperationException throws UnsupportedOperationException {
{ throw new UnsupportedOperationException("Illegal constructor call.");
throw new UnsupportedOperationException("Illegal constructor call."); }
}
/** /**
* Writes a string value to the specified writer. The default value is used when the actual value is null. * Converts <code>&lt;</code>, <code>&gt;</code>, <code>&amp;</code>, <code>'</code>, <code>"</code>
* * to their corresponding entity codes.
* @param out The writer to output the value to. *
* @param value The string value. * @param value The string value to convert.
* @param defaultValue The default value. * @return The converted string value.
* @param xml The {@link #escapeXml(String) xml} flag. */
* public static String escapeXml(final String value) {
* @throws IOException f an I/O error occurs. final StringBuilder escaped = new StringBuilder();
*/
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
throws IOException
{
if (xml)
{
if (value != null)
{
out.write(escapeXml(value));
}
else if (defaultValue != null)
{
out.write(escapeXml(defaultValue));
}
}
else
{
if (value != null)
{
out.write(value);
}
else if (defaultValue != null)
{
out.write(defaultValue);
}
}
}
/** for (int i = 0; i < value.length(); i++) {
* Converts <code>&lt;</code>, <code>&gt;</code>, <code>&amp;</code>, <code>'</code>, <code>"</code> final char c = value.charAt(i);
* to their corresponding entity codes. switch (c) {
* case '<':
* @param value The string value to convert. escaped.append("&lt;");
* break;
* @return The converted string value. case '>':
*/ escaped.append("&gt;");
public static String escapeXml(final String value) break;
{ case '&':
final StringBuilder escaped = new StringBuilder(); escaped.append("&amp;");
break;
case '\'':
escaped.append("&#039;");
break;
case '"':
escaped.append("&#034;");
break;
default:
escaped.append(c);
break;
}
}
for (int i = 0; i < value.length(); i++) return escaped.toString();
{ }
final char c = value.charAt(i);
switch (c)
{
case '<':
escaped.append("&lt;");
break;
case '>':
escaped.append("&gt;");
break;
case '&':
escaped.append("&amp;");
break;
case '\'':
escaped.append("&#039;");
break;
case '"':
escaped.append("&#034;");
break;
default:
escaped.append(c);
break;
}
}
return escaped.toString(); /**
} * Writes a string value to the specified writer. The default value is used when the actual value is null.
*
* @param out The writer to output the value to.
* @param value The string value.
* @param defaultValue The default value.
* @param xml The {@link #escapeXml(String) xml} flag.
* @throws IOException f an I/O error occurs.
*/
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
throws IOException {
if (xml) {
if (value != null) {
out.write(escapeXml(value));
} else if (defaultValue != null) {
out.write(escapeXml(defaultValue));
}
} else {
if (value != null) {
out.write(value);
} else if (defaultValue != null) {
out.write(defaultValue);
}
}
}
} }

View file

@ -45,29 +45,24 @@ import java.io.IOException;
* @created 2015-12-03 * @created 2015-12-03
* @since 1.0 * @since 1.0
*/ */
public class CauseTag extends XmlSupport public class CauseTag extends XmlSupport {
{ /**
/** * {@inheritDoc}
* {@inheritDoc} */
*/ @Override
@Override public void doTag()
public void doTag() throws JspException, IOException {
throws JspException, IOException final PageContext pageContext = (PageContext) getJspContext();
{ final JspWriter out = pageContext.getOut();
final PageContext pageContext = (PageContext) getJspContext();
final JspWriter out = pageContext.getOut();
String cause; String cause;
try try {
{ cause = pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage();
cause = pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage(); } catch (NullPointerException ignore) {
} cause = defaultValue;
catch (NullPointerException ignore) }
{
cause = defaultValue;
}
Utils.outWrite(out, cause, defaultValue, escapeXml); Utils.outWrite(out, cause, defaultValue, escapeXml);
} }
} }

View file

@ -44,18 +44,16 @@ import java.io.IOException;
* @created 2015-12-03 * @created 2015-12-03
* @since 1.0 * @since 1.0
*/ */
public class CodeTag extends SimpleTagSupport public class CodeTag extends SimpleTagSupport {
{ /**
/** * {@inheritDoc}
* {@inheritDoc} */
*/ @Override
@Override public void doTag()
public void doTag() throws JspException, IOException {
throws JspException, IOException final PageContext pageContext = (PageContext) getJspContext();
{ final JspWriter out = pageContext.getOut();
final PageContext pageContext = (PageContext) getJspContext();
final JspWriter out = pageContext.getOut();
out.write(String.valueOf(pageContext.getErrorData().getStatusCode())); out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));
} }
} }

View file

@ -47,50 +47,41 @@ import java.io.IOException;
* @created 2015-12-02 * @created 2015-12-02
* @since 1.0 * @since 1.0
*/ */
public class ReasonTag extends XmlSupport public class ReasonTag extends XmlSupport {
{ private int statusCode;
private int statusCode;
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public void doTag() public void doTag()
throws JspException, IOException throws JspException, IOException {
{ final PageContext pageContext = (PageContext) getJspContext();
final PageContext pageContext = (PageContext) getJspContext(); final JspWriter out = pageContext.getOut();
final JspWriter out = pageContext.getOut();
try try {
{ if (statusCode >= 0) {
if (statusCode >= 0) Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
{ } else {
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml); Utils.outWrite(out,
} Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()),
else defaultValue,
{ escapeXml);
Utils.outWrite(out, }
Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()), } catch (IOException ignore) {
defaultValue, // Ignore.
escapeXml); }
} }
}
catch (IOException ignore)
{
// Ignore.
}
}
/** /**
* Sets the status code. * Sets the status code.
* *
* @param statusCode The status code. * @param statusCode The status code.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void setCode(final int statusCode) public void setCode(final int statusCode) {
{ this.statusCode = statusCode;
this.statusCode = statusCode; }
}
} }

View file

@ -40,37 +40,34 @@ import javax.servlet.jsp.tagext.SimpleTagSupport;
* @created 2015-12-03 * @created 2015-12-03
* @since 1.0 * @since 1.0
*/ */
public abstract class XmlSupport extends SimpleTagSupport public abstract class XmlSupport extends SimpleTagSupport {
{ /**
/** * Default value string.
* Default value string. */
*/ protected String defaultValue;
protected String defaultValue;
/** /**
* Escape XML flag. * Escape XML flag.
*/ */
protected boolean escapeXml = true; protected boolean escapeXml = true;
/** /**
* Sets the default value. * Sets the default value.
* *
* @param defaultValue The default value. * @param defaultValue The default value.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void setDefault(final String defaultValue) public void setDefault(final String defaultValue) {
{ this.defaultValue = defaultValue;
this.defaultValue = defaultValue; }
}
/** /**
* Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag. * Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag.
* *
* @param escapeXml <code>true</code> or <code>false</code> * @param escapeXml <code>true</code> or <code>false</code>
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void setEscapeXml(final boolean escapeXml) public void setEscapeXml(final boolean escapeXml) {
{ this.escapeXml = escapeXml;
this.escapeXml = escapeXml; }
}
} }

View file

@ -1,35 +1,33 @@
/* /*
* ReasonsTest.java * ReasonsTest.java
* *
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are met:
* met:
* *
* Redistributions of source code must retain the above copyright notice, * Redistributions of source code must retain the above copyright notice, this
* this list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* *
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* *
* Neither the name of the author nor the names of its contributors may be * Neither the name of this project nor the names of its contributors may be
* used to endorse or promote products derived from this software without * used to endorse or promote products derived from this software without
* specific prior written permission. * specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.thauvin.erik.httpstatus; package net.thauvin.erik.httpstatus;
@ -47,27 +45,23 @@ import java.util.ResourceBundle;
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ReasonsTest public class ReasonsTest {
{ @DataProvider(name = "reasons")
@DataProvider(name = "reasons") public Object[][] reasons() {
public Object[][] reasons() final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
{ final Object[][] reasons = new String[bundle.keySet().size()][2];
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME); int i = 0;
final Object[][] reasons = new String[bundle.keySet().size()][2]; for (final String key : bundle.keySet()) {
int i = 0; reasons[i][0] = key;
for (final String key : bundle.keySet()) reasons[i][1] = bundle.getString(key);
{ i++;
reasons[i][0] = key; }
reasons[i][1] = bundle.getString(key); return reasons;
i++; }
}
return reasons;
}
@Test(dataProvider = "reasons") @Test(dataProvider = "reasons")
public void testGetReasonPhrase(String code, String reason) public void testGetReasonPhrase(String code, String reason)
throws Exception throws Exception {
{ Assert.assertEquals(reason, Reasons.getReasonPhrase(code));
Assert.assertEquals(reason, Reasons.getReasonPhrase(code)); }
}
} }

View file

@ -1,35 +1,33 @@
/* /*
* UtilsTest.java * UtilsTest.java
* *
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are met:
* met:
* *
* Redistributions of source code must retain the above copyright notice, * Redistributions of source code must retain the above copyright notice, this
* this list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* *
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* *
* Neither the name of the author nor the names of its contributors may be * Neither the name of this project nor the names of its contributors may be
* used to endorse or promote products derived from this software without * used to endorse or promote products derived from this software without
* specific prior written permission. * specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.thauvin.erik.httpstatus; package net.thauvin.erik.httpstatus;
@ -44,15 +42,13 @@ import org.testng.annotations.Test;
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class UtilsTest public class UtilsTest {
{ @Test
@Test public void testEscapeXml()
public void testEscapeXml() throws Exception {
throws Exception Assert.assertEquals(
{ "This is a test. We wan&#039;t to make sure that everything is &lt;encoded&gt; according the &#034;encoding&#034; parameter &amp; value.",
Assert.assertEquals( Utils.escapeXml(
"This is a test. We wan&#039;t to make sure that everything is &lt;encoded&gt; according the &#034;encoding&#034; parameter &amp; value.", "This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" parameter & value."));
Utils.escapeXml( }
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" parameter & value."));
}
} }