Commit 1d9b4682b9b92431accc8bb069e8bf1a0e97cbe1

Authored by andre.rezende
0 parents

Responsável: Rodrigo Lima. STATUS: EM HOMOLOGAÇÃO.

git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/ASES%20-%20Web/ASES%20-%20Web/Fontes/avaliador-api@9151 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Showing 161 changed files with 3676 additions and 0 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 161 files displayed.

.classpath 0 → 100644
  1 +++ a/.classpath
... ... @@ -0,0 +1,27 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" output="target/classes" path="src/main/java">
  4 + <attributes>
  5 + <attribute name="optional" value="true"/>
  6 + <attribute name="maven.pomderived" value="true"/>
  7 + </attributes>
  8 + </classpathentry>
  9 + <classpathentry kind="src" output="target/test-classes" path="src/test/java">
  10 + <attributes>
  11 + <attribute name="optional" value="true"/>
  12 + <attribute name="maven.pomderived" value="true"/>
  13 + </attributes>
  14 + </classpathentry>
  15 + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
  16 + <attributes>
  17 + <attribute name="maven.pomderived" value="true"/>
  18 + <attribute name="org.eclipse.jst.component.nondependency" value=""/>
  19 + </attributes>
  20 + </classpathentry>
  21 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
  22 + <attributes>
  23 + <attribute name="maven.pomderived" value="true"/>
  24 + </attributes>
  25 + </classpathentry>
  26 + <classpathentry kind="output" path="target/classes"/>
  27 +</classpath>
... ...
.gitignore 0 → 100644
  1 +++ a/.gitignore
... ... @@ -0,0 +1,5 @@
  1 +.classpath
  2 +.project
  3 +.settings/
  4 +target/
  5 +bin/
... ...
.project 0 → 100644
  1 +++ a/.project
... ... @@ -0,0 +1,36 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>emag-checker</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.wst.common.project.facet.core.builder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>org.eclipse.jdt.core.javabuilder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + <buildCommand>
  19 + <name>org.eclipse.wst.validation.validationbuilder</name>
  20 + <arguments>
  21 + </arguments>
  22 + </buildCommand>
  23 + <buildCommand>
  24 + <name>org.eclipse.m2e.core.maven2Builder</name>
  25 + <arguments>
  26 + </arguments>
  27 + </buildCommand>
  28 + </buildSpec>
  29 + <natures>
  30 + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
  31 + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
  32 + <nature>org.eclipse.jdt.core.javanature</nature>
  33 + <nature>org.eclipse.m2e.core.maven2Nature</nature>
  34 + <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
  35 + </natures>
  36 +</projectDescription>
... ...
.settings/org.eclipse.core.resources.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.core.resources.prefs
... ... @@ -0,0 +1,3 @@
  1 +eclipse.preferences.version=1
  2 +encoding//src/main/java/br/com/checker/emag/OccurrenceClassification.java=UTF-8
  3 +encoding//src/main/java/br/com/checker/emag/SummarizedOccurrence.java=UTF-8
... ...
.settings/org.eclipse.jdt.core.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.jdt.core.prefs
... ... @@ -0,0 +1,8 @@
  1 +eclipse.preferences.version=1
  2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  3 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
  4 +org.eclipse.jdt.core.compiler.compliance=1.5
  5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  6 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  7 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
  8 +org.eclipse.jdt.core.compiler.source=1.5
... ...
.settings/org.eclipse.m2e.core.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.m2e.core.prefs
... ... @@ -0,0 +1,4 @@
  1 +activeProfiles=
  2 +eclipse.preferences.version=1
  3 +resolveWorkspaceProjects=true
  4 +version=1
... ...
.settings/org.eclipse.wst.common.component 0 → 100644
  1 +++ a/.settings/org.eclipse.wst.common.component
... ... @@ -0,0 +1,6 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project-modules id="moduleCoreId" project-version="1.5.0">
  3 + <wb-module deploy-name="emag-checker">
  4 + <wb-resource deploy-path="/" source-path="/src/main/java"/>
  5 + </wb-module>
  6 +</project-modules>
... ...
.settings/org.eclipse.wst.common.project.facet.core.xml 0 → 100644
  1 +++ a/.settings/org.eclipse.wst.common.project.facet.core.xml
... ... @@ -0,0 +1,5 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<faceted-project>
  3 + <installed facet="java" version="1.5"/>
  4 + <installed facet="jst.utility" version="1.0"/>
  5 +</faceted-project>
... ...
.settings/org.eclipse.wst.validation.prefs 0 → 100644
  1 +++ a/.settings/org.eclipse.wst.validation.prefs
... ... @@ -0,0 +1,2 @@
  1 +disabled=06target
  2 +eclipse.preferences.version=1
... ...
README.md 0 → 100644
  1 +++ a/README.md
... ... @@ -0,0 +1,4 @@
  1 +emag-checker
  2 +============
  3 +
  4 +Emag Web Accessibility Checker
... ...
bin/.gitignore 0 → 100644
  1 +++ a/bin/.gitignore
... ... @@ -0,0 +1,4 @@
  1 +.classpath
  2 +.project
  3 +.settings/
  4 +target/
... ...
bin/.project 0 → 100644
  1 +++ a/bin/.project
... ... @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>emag-checker</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.jdt.core.javabuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>org.eclipse.m2e.core.maven2Builder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + </buildSpec>
  19 + <natures>
  20 + <nature>org.eclipse.jdt.core.javanature</nature>
  21 + <nature>org.eclipse.m2e.core.maven2Nature</nature>
  22 + </natures>
  23 +</projectDescription>
... ...
bin/.settings/org.eclipse.jdt.core.prefs 0 → 100644
  1 +++ a/bin/.settings/org.eclipse.jdt.core.prefs
... ... @@ -0,0 +1,8 @@
  1 +eclipse.preferences.version=1
  2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  3 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
  4 +org.eclipse.jdt.core.compiler.compliance=1.5
  5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  6 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  7 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
  8 +org.eclipse.jdt.core.compiler.source=1.5
... ...
bin/.settings/org.eclipse.m2e.core.prefs 0 → 100644
  1 +++ a/bin/.settings/org.eclipse.m2e.core.prefs
... ... @@ -0,0 +1,4 @@
  1 +activeProfiles=
  2 +eclipse.preferences.version=1
  3 +resolveWorkspaceProjects=true
  4 +version=1
... ...
bin/README.md 0 → 100644
  1 +++ a/bin/README.md
... ... @@ -0,0 +1,4 @@
  1 +emag-checker
  2 +============
  3 +
  4 +Emag Web Accessibility Checker
... ...
bin/pom.xml 0 → 100644
  1 +++ a/bin/pom.xml
... ... @@ -0,0 +1,30 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 + <groupId>br.com.checker.emag</groupId>
  5 + <artifactId>emag-checker</artifactId>
  6 + <packaging>jar</packaging>
  7 + <version>1.0</version>
  8 + <name>Emag Checker</name>
  9 + <url>http://maven.apache.org</url>
  10 + <dependencies>
  11 + <dependency>
  12 + <groupId>junit</groupId>
  13 + <artifactId>junit</artifactId>
  14 + <version>4.11</version>
  15 + <scope>test</scope>
  16 + </dependency>
  17 + <dependency>
  18 + <groupId>net.htmlparser.jericho</groupId>
  19 + <artifactId>jericho-html</artifactId>
  20 + <version>3.1</version>
  21 + <scope>compile</scope>
  22 + </dependency>
  23 + <dependency>
  24 + <groupId>org.projectlombok</groupId>
  25 + <artifactId>lombok</artifactId>
  26 + <version>0.12.0</version>
  27 + <scope>provided</scope>
  28 + </dependency>
  29 + </dependencies>
  30 +</project>
... ...
bin/src/main/java/br/com/checker/emag/Checker.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/Evaluation$EvaluationBuilder.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/Evaluation.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/FormEvaluation$AvaliacaoPrioridade1.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/FormEvaluation$FormEvaluationBuilder.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/FormEvaluation.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation1.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation2.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation3.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation4.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation5.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation6.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation7.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation8.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$EvaluationRecommendation9.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation$MarkEvaluationBuilder.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/MarkEvaluation.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/Occurrence.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/OccurrenceClassification.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/SpecificRecommendation$FormRecommendation.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/SpecificRecommendation$MarkRecommendation.class 0 → 100644
No preview for this file type
bin/src/main/java/br/com/checker/emag/SpecificRecommendation.class 0 → 100644
No preview for this file type
bin/src/test/java/br/com/checker/emag/CheckerTest.class 0 → 100644
No preview for this file type
bin/src/test/java/br/com/checker/emag/MarkEvaluationTest.class 0 → 100644
No preview for this file type
bin/target/classes/META-INF/MANIFEST.MF 0 → 100644
  1 +++ a/bin/target/classes/META-INF/MANIFEST.MF
... ... @@ -0,0 +1,5 @@
  1 +Manifest-Version: 1.0
  2 +Built-By: rodrigolima
  3 +Build-Jdk: 1.6.0_51
  4 +Created-By: Maven Integration for Eclipse
  5 +
... ...
bin/target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.properties 0 → 100644
  1 +++ a/bin/target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.properties
... ... @@ -0,0 +1,7 @@
  1 +#Generated by Maven Integration for Eclipse
  2 +#Sat Sep 28 00:04:46 GMT-03:00 2013
  3 +version=1.0
  4 +groupId=br.com.checker.emag
  5 +m2e.projectName=emag-checker
  6 +m2e.projectLocation=/Users/rodrigolima/workspace2/AvaliadorEmag/avaliador-emag
  7 +artifactId=emag-checker
... ...
bin/target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.xml 0 → 100644
  1 +++ a/bin/target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.xml
... ... @@ -0,0 +1,30 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 + <groupId>br.com.checker.emag</groupId>
  5 + <artifactId>emag-checker</artifactId>
  6 + <packaging>jar</packaging>
  7 + <version>1.0</version>
  8 + <name>Emag Checker</name>
  9 + <url>http://maven.apache.org</url>
  10 + <dependencies>
  11 + <dependency>
  12 + <groupId>junit</groupId>
  13 + <artifactId>junit</artifactId>
  14 + <version>4.11</version>
  15 + <scope>test</scope>
  16 + </dependency>
  17 + <dependency>
  18 + <groupId>net.htmlparser.jericho</groupId>
  19 + <artifactId>jericho-html</artifactId>
  20 + <version>3.1</version>
  21 + <scope>compile</scope>
  22 + </dependency>
  23 + <dependency>
  24 + <groupId>org.projectlombok</groupId>
  25 + <artifactId>lombok</artifactId>
  26 + <version>0.12.0</version>
  27 + <scope>provided</scope>
  28 + </dependency>
  29 + </dependencies>
  30 +</project>
... ...
bin/target/emag-checker-1.0.jar 0 → 100644
No preview for this file type
bin/target/maven-archiver/pom.properties 0 → 100644
  1 +++ a/bin/target/maven-archiver/pom.properties
... ... @@ -0,0 +1,5 @@
  1 +#Generated by Maven
  2 +#Fri Sep 27 23:56:18 GMT-03:00 2013
  3 +version=1.0
  4 +groupId=br.com.checker.emag
  5 +artifactId=emag-checker
... ...
bin/target/surefire-reports/TEST-br.com.checker.emag.CheckerTest.xml 0 → 100644
  1 +++ a/bin/target/surefire-reports/TEST-br.com.checker.emag.CheckerTest.xml
... ... @@ -0,0 +1,68 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<testsuite failures="0" time="0.136" errors="0" skipped="0" tests="1" name="br.com.checker.emag.CheckerTest">
  3 + <properties>
  4 + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
  5 + <property name="sun.boot.library.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries"/>
  6 + <property name="java.vm.version" value="20.51-b01-457"/>
  7 + <property name="awt.nativeDoubleBuffering" value="true"/>
  8 + <property name="gopherProxySet" value="false"/>
  9 + <property name="mrj.build" value="10M4509"/>
  10 + <property name="java.vm.vendor" value="Apple Inc."/>
  11 + <property name="java.vendor.url" value="http://www.apple.com/"/>
  12 + <property name="path.separator" value=":"/>
  13 + <property name="guice.disable.misplaced.annotation.check" value="true"/>
  14 + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
  15 + <property name="file.encoding.pkg" value="sun.io"/>
  16 + <property name="user.country" value="BR"/>
  17 + <property name="sun.java.launcher" value="SUN_STANDARD"/>
  18 + <property name="sun.os.patch.level" value="unknown"/>
  19 + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
  20 + <property name="user.dir" value="/Users/rodrigolima/workspace2/AvaliadorEmag/avaliador-emag"/>
  21 + <property name="java.runtime.version" value="1.6.0_51-b11-457-10M4509"/>
  22 + <property name="java.awt.graphicsenv" value="apple.awt.CGraphicsEnvironment"/>
  23 + <property name="java.endorsed.dirs" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed"/>
  24 + <property name="os.arch" value="x86_64"/>
  25 + <property name="java.io.tmpdir" value="/var/folders/8u/8uHGrZqbF+444kjmSGH7uE+++TI/-Tmp-/"/>
  26 + <property name="line.separator" value="
  27 +"/>
  28 + <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
  29 + <property name="os.name" value="Mac OS X"/>
  30 + <property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/>
  31 + <property name="sun.jnu.encoding" value="MacRoman"/>
  32 + <property name="java.library.path" value=".:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"/>
  33 + <property name="java.specification.name" value="Java Platform API Specification"/>
  34 + <property name="java.class.version" value="50.0"/>
  35 + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
  36 + <property name="os.version" value="10.6.8"/>
  37 + <property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
  38 + <property name="user.home" value="/Users/rodrigolima"/>
  39 + <property name="user.timezone" value="GMT-03:00"/>
  40 + <property name="java.awt.printerjob" value="apple.awt.CPrinterJob"/>
  41 + <property name="java.specification.version" value="1.6"/>
  42 + <property name="file.encoding" value="MacRoman"/>
  43 + <property name="user.name" value="rodrigolima"/>
  44 + <property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.4.jar"/>
  45 + <property name="java.vm.specification.version" value="1.0"/>
  46 + <property name="sun.arch.data.model" value="64"/>
  47 + <property name="java.home" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"/>
  48 + <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher clean install"/>
  49 + <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
  50 + <property name="user.language" value="pt"/>
  51 + <property name="awt.toolkit" value="apple.awt.CToolkit"/>
  52 + <property name="java.vm.info" value="mixed mode"/>
  53 + <property name="java.version" value="1.6.0_51"/>
  54 + <property name="java.ext.dirs" value="/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext"/>
  55 + <property name="sun.boot.class.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar"/>
  56 + <property name="java.vendor" value="Apple Inc."/>
  57 + <property name="maven.home" value="/usr/share/maven"/>
  58 + <property name="file.separator" value="/"/>
  59 + <property name="java.vendor.url.bug" value="http://bugreport.apple.com/"/>
  60 + <property name="sun.cpu.endian" value="little"/>
  61 + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
  62 + <property name="mrj.version" value="1060.1.6.0_51-457"/>
  63 + <property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
  64 + <property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
  65 + <property name="sun.cpu.isalist" value=""/>
  66 + </properties>
  67 + <testcase time="0" classname="br.com.checker.emag.CheckerTest" name="deveRetornarTodasOcorrenciasDeMarcacao"/>
  68 +</testsuite>
0 69 \ No newline at end of file
... ...
bin/target/surefire-reports/TEST-br.com.checker.emag.MarkEvaluationTest.xml 0 → 100644
  1 +++ a/bin/target/surefire-reports/TEST-br.com.checker.emag.MarkEvaluationTest.xml
... ... @@ -0,0 +1,80 @@
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<testsuite failures="0" time="0.123" errors="0" skipped="0" tests="13" name="br.com.checker.emag.MarkEvaluationTest">
  3 + <properties>
  4 + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
  5 + <property name="sun.boot.library.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries"/>
  6 + <property name="java.vm.version" value="20.51-b01-457"/>
  7 + <property name="awt.nativeDoubleBuffering" value="true"/>
  8 + <property name="gopherProxySet" value="false"/>
  9 + <property name="mrj.build" value="10M4509"/>
  10 + <property name="java.vm.vendor" value="Apple Inc."/>
  11 + <property name="java.vendor.url" value="http://www.apple.com/"/>
  12 + <property name="path.separator" value=":"/>
  13 + <property name="guice.disable.misplaced.annotation.check" value="true"/>
  14 + <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
  15 + <property name="file.encoding.pkg" value="sun.io"/>
  16 + <property name="user.country" value="BR"/>
  17 + <property name="sun.java.launcher" value="SUN_STANDARD"/>
  18 + <property name="sun.os.patch.level" value="unknown"/>
  19 + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
  20 + <property name="user.dir" value="/Users/rodrigolima/workspace2/AvaliadorEmag/avaliador-emag"/>
  21 + <property name="java.runtime.version" value="1.6.0_51-b11-457-10M4509"/>
  22 + <property name="java.awt.graphicsenv" value="apple.awt.CGraphicsEnvironment"/>
  23 + <property name="java.endorsed.dirs" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed"/>
  24 + <property name="os.arch" value="x86_64"/>
  25 + <property name="java.io.tmpdir" value="/var/folders/8u/8uHGrZqbF+444kjmSGH7uE+++TI/-Tmp-/"/>
  26 + <property name="line.separator" value="
  27 +"/>
  28 + <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
  29 + <property name="os.name" value="Mac OS X"/>
  30 + <property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/>
  31 + <property name="sun.jnu.encoding" value="MacRoman"/>
  32 + <property name="java.library.path" value=".:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"/>
  33 + <property name="java.specification.name" value="Java Platform API Specification"/>
  34 + <property name="java.class.version" value="50.0"/>
  35 + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
  36 + <property name="os.version" value="10.6.8"/>
  37 + <property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
  38 + <property name="user.home" value="/Users/rodrigolima"/>
  39 + <property name="user.timezone" value="GMT-03:00"/>
  40 + <property name="java.awt.printerjob" value="apple.awt.CPrinterJob"/>
  41 + <property name="java.specification.version" value="1.6"/>
  42 + <property name="file.encoding" value="MacRoman"/>
  43 + <property name="user.name" value="rodrigolima"/>
  44 + <property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.4.jar"/>
  45 + <property name="java.vm.specification.version" value="1.0"/>
  46 + <property name="sun.arch.data.model" value="64"/>
  47 + <property name="java.home" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"/>
  48 + <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher clean install"/>
  49 + <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
  50 + <property name="user.language" value="pt"/>
  51 + <property name="awt.toolkit" value="apple.awt.CToolkit"/>
  52 + <property name="java.vm.info" value="mixed mode"/>
  53 + <property name="java.version" value="1.6.0_51"/>
  54 + <property name="java.ext.dirs" value="/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext"/>
  55 + <property name="sun.boot.class.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar"/>
  56 + <property name="java.vendor" value="Apple Inc."/>
  57 + <property name="maven.home" value="/usr/share/maven"/>
  58 + <property name="file.separator" value="/"/>
  59 + <property name="java.vendor.url.bug" value="http://bugreport.apple.com/"/>
  60 + <property name="sun.cpu.endian" value="little"/>
  61 + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
  62 + <property name="mrj.version" value="1060.1.6.0_51-457"/>
  63 + <property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
  64 + <property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
  65 + <property name="sun.cpu.isalist" value=""/>
  66 + </properties>
  67 + <testcase time="0.08" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation9ComoWarning"/>
  68 + <testcase time="0.001" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation1"/>
  69 + <testcase time="0.001" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation3"/>
  70 + <testcase time="0.023" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation4"/>
  71 + <testcase time="0.001" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation5"/>
  72 + <testcase time="0.012" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation6"/>
  73 + <testcase time="0" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation7"/>
  74 + <testcase time="0" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation8"/>
  75 + <testcase time="0" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldCheckRecommedation9WithError"/>
  76 + <testcase time="0.001" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldAlwaysCheckRecommendation2"/>
  77 + <testcase time="0" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldNotCheckRecommedation1"/>
  78 + <testcase time="0" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldNotReturnRecommendationOccurrence6"/>
  79 + <testcase time="0" classname="br.com.checker.emag.MarkEvaluationTest" name="shouldNotReturnRecommendationOccurrence8"/>
  80 +</testsuite>
0 81 \ No newline at end of file
... ...
bin/target/surefire-reports/br.com.checker.emag.CheckerTest.txt 0 → 100644
  1 +++ a/bin/target/surefire-reports/br.com.checker.emag.CheckerTest.txt
... ... @@ -0,0 +1,4 @@
  1 +-------------------------------------------------------------------------------
  2 +Test set: br.com.checker.emag.CheckerTest
  3 +-------------------------------------------------------------------------------
  4 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.137 sec
... ...
bin/target/surefire-reports/br.com.checker.emag.MarkEvaluationTest.txt 0 → 100644
  1 +++ a/bin/target/surefire-reports/br.com.checker.emag.MarkEvaluationTest.txt
... ... @@ -0,0 +1,4 @@
  1 +-------------------------------------------------------------------------------
  2 +Test set: br.com.checker.emag.MarkEvaluationTest
  3 +-------------------------------------------------------------------------------
  4 +Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 sec
... ...
pom.xml 0 → 100644
  1 +++ a/pom.xml
... ... @@ -0,0 +1,50 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 + <groupId>br.com.checker.emag</groupId>
  5 + <artifactId>emag-checker</artifactId>
  6 + <packaging>jar</packaging>
  7 + <version>1.0</version>
  8 + <name>Emag Checker</name>
  9 + <url>http://maven.apache.org</url>
  10 + <dependencies>
  11 + <dependency>
  12 + <groupId>junit</groupId>
  13 + <artifactId>junit</artifactId>
  14 + <version>4.11</version>
  15 + <scope>test</scope>
  16 + </dependency>
  17 + <dependency>
  18 + <groupId>net.htmlparser.jericho</groupId>
  19 + <artifactId>jericho-html</artifactId>
  20 + <version>3.1</version>
  21 + <scope>compile</scope>
  22 + </dependency>
  23 +
  24 + <dependency>
  25 + <groupId>org.apache.commons</groupId>
  26 + <artifactId>commons-lang3</artifactId>
  27 + <version>3.0</version>
  28 + </dependency>
  29 +
  30 + <dependency>
  31 + <groupId>org.projectlombok</groupId>
  32 + <artifactId>lombok</artifactId>
  33 + <version>0.12.0</version>
  34 + <scope>provided</scope>
  35 + </dependency>
  36 +
  37 + <dependency>
  38 + <groupId>xstream</groupId>
  39 + <artifactId>xstream</artifactId>
  40 + <version>1.2.2</version>
  41 + </dependency>
  42 +
  43 + <dependency>
  44 + <groupId>org.ogce</groupId>
  45 + <artifactId>xpp3</artifactId>
  46 + <version>1.1.6</version>
  47 + </dependency>
  48 +
  49 + </dependencies>
  50 +</project>
... ...
src/main/java/br/com/checker/emag/Occurrence.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/Occurrence.java
... ... @@ -0,0 +1,37 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import lombok.Getter;
  4 +import lombok.ToString;
  5 +
  6 +@ToString
  7 +public @Getter class Occurrence {
  8 +
  9 + private Integer line;
  10 + private Integer column;
  11 + private String code;
  12 + private boolean error;
  13 + private String tag;
  14 + private OccurrenceClassification type;
  15 +
  16 + public Occurrence(int line, int column, String code, boolean error,
  17 + String tag,
  18 + OccurrenceClassification type) {
  19 + this.line = line;
  20 + this.column = column;
  21 + this.code = code;
  22 + this.error = error;
  23 + this.tag = tag;
  24 + this.type = type;
  25 + }
  26 +
  27 + public Occurrence(String code, boolean error,
  28 + String tag,
  29 + OccurrenceClassification type) {
  30 + this.code = code;
  31 + this.error = error;
  32 + this.tag = tag;
  33 + this.type = type;
  34 + }
  35 +
  36 +
  37 +}
... ...
src/main/java/br/com/checker/emag/OccurrenceClassification.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/OccurrenceClassification.java
... ... @@ -0,0 +1,22 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import lombok.Getter;
  4 +
  5 +public enum OccurrenceClassification {
  6 +
  7 + MARK("2.1","Marcação"),
  8 + BEHAVIOR("2.2","Comportamento"),
  9 + CONTENT_INFORMATION("2.3","Conteúdo/Informação"),
  10 + PRESENTATION_DESIGN("2.4","Apresentação / Design"),
  11 + MULTIMEDIA("2.5","Multimídia"),
  12 + FORM("2.6","Formulários");
  13 +
  14 + OccurrenceClassification(String code,String description) {
  15 + this.code = code;
  16 + this.description = description;
  17 + }
  18 +
  19 + @Getter private final String code;
  20 + @Getter private final String description;
  21 +}
  22 +
... ...
src/main/java/br/com/checker/emag/SummarizedOccurrence.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/SummarizedOccurrence.java
... ... @@ -0,0 +1,133 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.HashSet;
  5 +import java.util.Map;
  6 +import java.util.Set;
  7 +
  8 +import lombok.Getter;
  9 +
  10 +import org.apache.commons.lang3.StringUtils;
  11 +
  12 +
  13 +public @Getter class SummarizedOccurrence implements Comparable<SummarizedOccurrence> {
  14 +
  15 + private static final String EMPTY_LINES = "---";
  16 +
  17 + private String checkPoint;
  18 + private boolean isError;
  19 + private Set<Integer> lines;
  20 + private OccurrenceClassification type;
  21 + private Map<String, String> mapDescription = new HashMap<String, String>();
  22 +
  23 + {
  24 + mapDescription.put("1", "\u00C9 essencial seguir os padr\u00F5es de desenvolvimento Web, do W3C (World Wide Web Consortium), com o intuito de maximizar a compatibilidade com atuais e futuros agentes de usu\u00E1rio.");
  25 + mapDescription.put("2","O c\u00F3digo HTML deve ser organizado de forma l\u00F3gica e sem\u00E2ntica, ou seja, apresentando os elementos em uma ordem compreens\u00EDvel e correspondendo ao conte\u00FAdo desejado. Assim, marca\u00E7\u00E3o sem\u00E2ntica adequada deve ser utilizada para designar os cabe\u00E7alhos (h1, h2, h3), as listas (ul, ol, dl), texto enfatizado (strong), marca\u00E7\u00E3o de c\u00F3digo (code), marca\u00E7\u00E3o de abreviaturas (abbr), marca\u00E7\u00E3o de cita\u00E7\u00F5es longas (blockquote), etc.");
  26 + mapDescription.put("3","Os n\u00EDveis de cabe\u00E7alho devem ser utilizados de forma l\u00F3gica e sem\u00E2ntica para facilitar a leitura e compreens\u00E3o. Al\u00E9m disso, pessoas acessando uma p\u00E1gina com leitor de tela podem navegar atrav\u00E9s dos cabe\u00E7alhos, pulando de um para outro, agilizando, assim, a navega\u00E7\u00E3o. Conceitualmente, existem seis n\u00EDveis de t\u00EDtulos, sendo o h1 o mais alto, ou seja, dever\u00E1 corresponder ao t\u00EDtulo principal da p\u00E1gina. Dessa forma, cada p\u00E1gina dever\u00E1 ter apenas um h1, o qual poder\u00E1 ser substitu\u00EDdo por uma imagem, mas dever\u00E1 permanecer com seu conte\u00FAdo, mesmo que n\u00E3o visualmente, permitindo a leitura pelo leitor de tela. J\u00E1 os n\u00EDveis do h2 ao h6 poder\u00E3o ser utilizados mais de uma vez na p\u00E1gina, mas sem excesso e com l\u00F3gica textual.");
  27 + mapDescription.put("4","Deve-se criar o c\u00F3digo HTML com uma sequ\u00EAncia l\u00F3gica de leitura para percorrer links, controles de formul\u00E1rios e objetos. Essa sequ\u00EAncia \u00E9 determinada pela ordem que se encontra no c\u00F3digo HTML.");
  28 + mapDescription.put("5","Todas as fun\u00E7\u00F5es da p\u00E1gina desenvolvidas utilizando-se linguagens de script (javascript) dever\u00E3o estar dispon\u00EDveis quando for utilizado apenas o teclado. \u00C9 importante salientar que o foco n\u00E3o dever\u00E1 estar bloqueado ou fixado em um elemento da p\u00E1gina, para que o usu\u00E1rio possa mover-se pelo teclado por todos os elementos.");
  29 + mapDescription.put("6","Devem ser fornecidas \u00E2ncoras, dispon\u00EDveis na barra de acessibilidade, que apontem para links relevantes presentes na mesma p\u00E1gina. Assim, \u00E9 poss\u00EDvel ir ao bloco de conte\u00FAdo desejado. Os links devem ser colocados em lugares estrat\u00E9gicos da p\u00E1gina, como por exemplo, no in\u00EDcio e final do menu, do conte\u00FAdo, etc.");
  30 + mapDescription.put("7","As tabelas devem ser utilizadas apenas para dados tabulares e n\u00E3o para efeitos de disposi\u00E7\u00E3o dos elementos na p\u00E1gina. Para este fim, utilize as folhas de estilo.");
  31 + mapDescription.put("8","Links adjacentes devem ser separados por mais do que simples espa\u00E7os, para que n\u00E3o fiquem confusos, em especial para usu\u00E1rios que utilizam leitor de tela. Para isso, \u00E9 recomendado o uso de listas, onde cada elemento dentro da lista \u00E9 um link. As listas podem ser estilizadas com CSS para que os itens sejam mostrados da maneira desejada, como um ao lado do outro, por exemplo.");
  32 + mapDescription.put("9","N\u00E3o dever\u00E3o ocorrer mudan\u00E7as substanciais em uma p\u00E1gina. Assim, n\u00E3o devem ser utilizados:\nPop-ups\nA abertura de novas abas ou janelas\nO uso do atributo target=\u201C_blank\u201D\nMudan\u00E7as no controle do foco do teclado\nEntre outras, que n\u00E3o tenham sido solicitadas pelo usu\u00E1rio.");
  33 + mapDescription.put("10","Deve-se garantir que scripts, Flash, conte\u00FAdos din\u00E2micos e outros elementos program\u00E1veis sejam acess\u00EDveis. Se n\u00E3o for poss\u00EDvel que o elemento program\u00E1vel seja diretamente acess\u00EDvel, deve ser fornecida uma alternativa em HTML para o conte\u00FAdo. Assim, \u00E9 preciso garantir que o conte\u00FAdo e as funcionalidades de objetos program\u00E1veis sejam acess\u00EDveis aos recursos de tecnologia assistiva e que seja poss\u00EDvel navega\u00E7\u00E3o por teclado.");
  34 + mapDescription.put("11","N\u00E3o devem ser criadas p\u00E1ginas com atualiza\u00E7\u00E3o autom\u00E1tica peri\u00F3dica. Assim, n\u00E3o deve ser utilizada a meta tag refresh, nem outra forma de atualiza\u00E7\u00E3o autom\u00E1tica. P\u00E1ginas que se atualizam automaticamente podem confundir e desorientar os usu\u00E1rios, especialmente usu\u00E1rios que utilizam leitores de tela.");
  35 + mapDescription.put("12","N\u00E3o devem ser utilizadas marca\u00E7\u00F5es para redirecionar para uma nova p\u00E1gina, como a meta tag refresh. Ao inv\u00E9s disso, deve-se configurar o servidor para que o redirecionamento seja transparente para o usu\u00E1rio.");
  36 + mapDescription.put("13","Em uma p\u00E1gina onde h\u00E1 limite de tempo para realizar uma tarefa deve haver a op\u00E7\u00E3o de desligar, ajustar ou prolongar esse limite. \nEssa recomenda\u00E7\u00E3o n\u00E3o se aplica a eventos em que o limite de tempo \u00E9 absolutamente necess\u00E1rio.");
  37 + mapDescription.put("14","N\u00E3o devem ser utilizados efeitos visuais piscantes, intermitentes ou cintilantes. Em pessoas com epilepsia fotosensitiva, o cintilar ou piscar pode desencadear um ataque epil\u00E9tico. A exig\u00EAncia dessa diretriz aplica-se tamb\u00E9m para propaganda de terceiros inserida na p\u00E1gina.\nAs tags blink e marquee n\u00E3o devem ser utilizadas, mesmo em um documento escrito em XHTML personalizado.");
  38 + mapDescription.put("15","Conte\u00FAdos que \u201Cse movem\u201D, rolagens, movimenta\u00E7\u00F5es em geral ou anima\u00E7\u00F5es n\u00E3o devem ser disparadas automaticamente sem o controle do usu\u00E1rio, mesmo em propagandas na p\u00E1gina. Ao usu\u00E1rio deve ser repassado o controle sobre essas movimenta\u00E7\u00F5es (quer seja por escolha de prefer\u00EAncia de visualiza\u00E7\u00E3o da p\u00E1gina, quer por outro m\u00E9todo qualquer acess\u00EDvel a usu\u00E1rio com defici\u00EAncia). Al\u00E9m disso, o usu\u00E1rio deve ser capaz de parar e reiniciar conte\u00FAdos que se movem, sem exce\u00E7\u00E3o. A velocidade desses conte\u00FAdos tamb\u00E9m deve ser pass\u00EDvel de controle pelo usu\u00E1rio, a menos que a implementa\u00E7\u00E3o de mecanismo para alterar a velocidade seja uma tarefa de dif\u00EDcil execu\u00E7\u00E3o (se for necess\u00E1rio realizar uma escolha baseando-se nas limita\u00E7\u00F5es, prefira implementar mecanismos para reduzir a velocidade dos conte\u00FAdo no lugar de aumentar).");
  39 + mapDescription.put("16","Deve-se identificar o principal idioma utilizado nos documentos. A identifica\u00E7\u00E3o \u00E9 feita por meio do atributo lang do HTML e, para documentos XHTML, \u00E9 utilizado o xml:lang.");
  40 + mapDescription.put("17","O t\u00EDtulo da p\u00E1gina deve ser descritivo e informativo, j\u00E1 que essa informa\u00E7\u00E3o ser\u00E1 a primeira lida pelo leitor de tela, quando o usu\u00E1rio acessar a p\u00E1gina. O t\u00EDtulo \u00E9 informado pela tag <title>.");
  41 + mapDescription.put("18","Dever\u00E1 ser fornecido um mecanismo que permita ao usu\u00E1rio orientar-se dentro de um conjunto de p\u00E1ginas, permitindo que ele saiba onde est\u00E1 no momento. Assim, dever\u00E3o ser utilizados breadcrumbs, que s\u00E3o links naveg\u00E1veis em forma de lista hier\u00E1rquica que permitem que o usu\u00E1rio saiba qual o caminho percorrido at\u00E9 chegar \u00E0 p\u00E1gina em que se encontra no momento.");
  42 + mapDescription.put("19","Deve-se identificar claramente o destino de cada link, informando, inclusive, se o link remete a outro s\u00EDtio. Al\u00E9m disso, \u00E9 preciso que o texto do link fa\u00E7a sentido mesmo quando isolado do contexto da p\u00E1gina.\n\u00C9 preciso tomar cuidado para n\u00E3o utilizar o mesmo t\u00EDtulo para dois ou mais links que apontem para destinos diferentes.");
  43 + mapDescription.put("20","Deve ser fornecida uma descri\u00E7\u00E3o para as imagens da p\u00E1gina, utilizando-se o atributo alt. Imagens que n\u00E3o transmitem conte\u00FAdo, ou seja, imagens decorativas, devem ser inseridas por CSS.");
  44 + mapDescription.put("21","Para mapas de imagem do lado do cliente, devem ser fornecidas descri\u00E7\u00F5es atrav\u00E9s do atributo alt para cada uma das zonas ativas, ou seja, para cada um dos links que receber\u00E1 o foco.\nAl\u00E9m dos mapas de imagem do lado do cliente, existem os do lado do servidor. No entanto, \u00E9 recomendada a utiliza\u00E7\u00E3o de mapas de imagem do lado do cliente, j\u00E1 que para mapas de imagem do lado do servidor n\u00E3o \u00E9 poss\u00EDvel fornecer um alt para cada uma das zonas ativas, somente para o mapa como um todo, n\u00E3o sendo poss\u00EDvel, portanto, torn\u00E1-lo acess\u00EDvel.");
  45 + mapDescription.put("22","\nOs documentos devem ser disponibilizados preferencialmente em HTML. Tamb\u00E9m podem ser utilizados arquivos para download no formato ODF, tomando-se os cuidados para que sejam acess\u00EDveis. Se um arquivo for disponibilizado em PDF, dever\u00E1 ser fornecida uma alternativa em HTML ou ODF. \u00C9 necess\u00E1rio, tamb\u00E9m, informar a extens\u00E3o e o tamanho do arquivo no pr\u00F3prio texto do link.");
  46 + mapDescription.put("23","O t\u00EDtulo da tabela deve ser definido pelo elemento caption e deve ser o primeiro elemento utilizado ap\u00F3s a declara\u00E7\u00E3o do elemento table. Em casos de tabelas extensas, deve ser fornecido um resumo de seus dados atrav\u00E9s do atributo summary que deve ser declarado no elemento table.");
  47 + mapDescription.put("24","Em tabelas de dados simples, a uso apropriado do elemento th para os cabe\u00E7alhos e do elemento td para as c\u00E9lulas de dados \u00E9 essencial para torn\u00E1-las acess\u00EDveis. Para incrementar a acessibilidade, deve-se utilizar os elementos thead, tbody e tfoot, para agrupar as linhas de cabe\u00E7alho, do corpo da tabela e do final, respectivamente, com exce\u00E7\u00E3o de quando a tabela possuir apenas o corpo, sem ter se\u00E7\u00F5es de cabe\u00E7alho e rodap\u00E9. O W3C sugere utilizar o tfoot antes do tbody dentro da defini\u00E7\u00E3o table para que o agente de usu\u00E1rio possa renderizar o rodap\u00E9 antes de receber todas (potencialmente numerosas) linha de dados.");
  48 + mapDescription.put("25","O texto de um s\u00EDtio deve ser de f\u00E1cil leitura e compreens\u00E3o, n\u00E3o exigindo do usu\u00E1rio um n\u00EDvel de instru\u00E7\u00E3o mais avan\u00E7ado do que o ensino fundamental completo. Quando o texto exigir uma capacidade de leitura mais avan\u00E7ada,\u00A0deve estar dispon\u00EDvel\u00A0conte\u00FAdo suplementar ou uma vers\u00E3o mais simplificada do conte\u00FAdo em texto.");
  49 + mapDescription.put("26","Deve estar dispon\u00EDvel uma explica\u00E7\u00E3o que identifique a forma completa ou o significado das abreviaturas e siglas. Para isso, deve ser utilizada a tag abbr. J\u00E1 as palavras que podem ser amb\u00EDguas, desconhecidas ou utilizadas de forma muito espec\u00EDfica, dever\u00E3o ser definidas atrav\u00E9s de um texto adjacente, uma lista de defini\u00E7\u00F5es, um gloss\u00E1rio, ou de qualquer outro modo.");
  50 + mapDescription.put("27","Se algum elemento de uma p\u00E1gina possuir conte\u00FAdo em um idioma diferente do principal, este dever\u00E1 estar identificado pelo atributo lang. Essa recomenda\u00E7\u00E3o n\u00E3o se aplica para nomes pr\u00F3prios, termos t\u00E9cnicos ou locu\u00E7\u00F5es pr\u00F3prias da l\u00EDngua que sejam compreendidas no contexto.");
  51 + mapDescription.put("28","As cores do plano de fundo e do primeiro plano dever\u00E3o ser suficientemente contrastantes para que possam ser visualizadas, tamb\u00E9m, por pessoas com baixa vis\u00E3o, com cromodefici\u00EAncias ou que utilizam monitores de v\u00EDdeo monocrom\u00E1tico.\nN\u00E3o dever\u00E3o ser utilizadas imagens atr\u00E1s do texto (background), pois acabam por dificultar a leitura e desviar a aten\u00E7\u00E3o do usu\u00E1rio.");
  52 + mapDescription.put("29","A cor ou outras caracter\u00EDsticas sensoriais, como forma, tamanho, localiza\u00E7\u00E3o visual, orienta\u00E7\u00E3o ou som n\u00E3o devem ser utilizadas como o \u00FAnico meio para transmitir informa\u00E7\u00F5es, indicar uma a\u00E7\u00E3o, pedir uma resposta ao usu\u00E1rio ou distinguir um elemento visual.");
  53 + mapDescription.put("30","A p\u00E1gina deve continuar leg\u00EDvel e funcional quando redimensionada para at\u00E9 200%. Assim, \u00E9 preciso garantir que, quando a p\u00E1gina for redimensionada, n\u00E3o ocorram sobreposi\u00E7\u00F5es de texto nem o aparecimento de uma barra horizontal.");
  54 + mapDescription.put("31","Grandes blocos de informa\u00E7\u00E3o devem ser divididos em grupos mais f\u00E1ceis de gerenciar. As divis\u00F5es mais comuns s\u00E3o \u201Ctopo\u201D, \u201Cconte\u00FAdo\u201D, \u201Cmenu\u201D e \u201Crodap\u00E9\u201D. Nas p\u00E1ginas internas deve-se manter uma mesma divis\u00E3o para que o usu\u00E1rio se familiarize mais rapidamente com a estrutura do s\u00EDtio. \u00C9 importante destacar, entretanto, que a p\u00E1gina inicial pode ter uma divis\u00E3o diferente das p\u00E1ginas internas, pois normalmente ela cont\u00E9m mais elementos. O exemplo a seguir mostra a divis\u00E3o da p\u00E1gina inicial de um s\u00EDtio contendo os blocos \u201Ctopo\u201D, \u201Cmenu\u201D, \u201Cconte\u00FAdo\u201D e \u201Crodap\u00E9\u201D, al\u00E9m da barra de acessibilidade contendo os atalhos.");
  55 + mapDescription.put("32","A \u00E1rea que recebe o foco pelo teclado deve ser claramente marcada, devendo a \u00E1rea de sele\u00E7\u00E3o ser pass\u00EDvel de ser clicada. \nPor padr\u00E3o, links e elementos de formul\u00E1rio j\u00E1 apresentam a borda destacada ao receberem o foco do teclado. Essa borda pode ser modificada via CSS, mas n\u00E3o dever\u00E1 ser removida.");
  56 + mapDescription.put("33","Deve haver uma alternativa sonora ou textual para v\u00EDdeos que n\u00E3o incluem faixas de \u00E1udio. Para v\u00EDdeos que cont\u00EAm \u00E1udio falado e no idioma natural da p\u00E1gina, devem ser fornecidas legendas. Al\u00E9m de essencial para pessoas com defici\u00EAncia visual, a alternativa em texto tamb\u00E9m \u00E9 importante para usu\u00E1rios que n\u00E3o possuem equipamento de som, que desejam apenas realizar a leitura do material ou n\u00E3o disp\u00F5em de tempo para ouvir um arquivo multim\u00EDdia. ");
  57 + mapDescription.put("34","\u00C1udio gravado deve possuir uma transcri\u00E7\u00E3o descritiva. Al\u00E9m de essencial para pessoas com defici\u00EAncia auditiva, a alternativa em texto tamb\u00E9m \u00E9 importante para usu\u00E1rios que n\u00E3o possuem equipamento de som, que desejam apenas realizar a leitura do material ou n\u00E3o disp\u00F5em de tempo para ouvir um arquivo multim\u00EDdia. Neste caso, tamb\u00E9m \u00E9 desej\u00E1vel a alternativa em Libras.");
  58 + mapDescription.put("35","V\u00EDdeos que transmitem conte\u00FAdo visual que n\u00E3o est\u00E1 dispon\u00EDvel na faixa de \u00E1udio devem possuir uma audiodescri\u00E7\u00E3o.");
  59 + mapDescription.put("36","Deve ser fornecido um mecanismo para parar, pausar, silenciar ou ajustar o volume de qualquer som que se reproduza automaticamente na p\u00E1gina.");
  60 + mapDescription.put("37","Para qualquer anima\u00E7\u00E3o que inicie automaticamente na p\u00E1gina devem ser fornecidos mecanismos para que o usu\u00E1rio possa pausar, parar ou ocultar tal anima\u00E7\u00E3o.");
  61 + mapDescription.put("38","Ao serem utilizados bot\u00F5es do tipo imagem (input type=\u201Dimage\u201D), que servem para o mesmo prop\u00F3sito do bot\u00E3o do tipo submit, deve ser fornecida uma descri\u00E7\u00E3o textual para o bot\u00E3o atrav\u00E9s do atributo alt.");
  62 + mapDescription.put("39","As etiquetas de texto (label) devem estar associadas aos seus campos (input) correspondentes no formul\u00E1rio, atrav\u00E9s dos atributos for do label e id do input, os quais dever\u00E3o ter o mesmo valor.");
  63 + mapDescription.put("40","Os elementos do formul\u00E1rio devem ser distribu\u00EDdos corretamente atrav\u00E9s do c\u00F3digo HTML, criando, assim, uma sequ\u00EAncia l\u00F3gica de navega\u00E7\u00E3o. Assim, os formul\u00E1rios devem primeiro ser codificados considerando a ordem l\u00F3gica de navega\u00E7\u00E3o para depois serem organizados visualmente via CSS.");
  64 + mapDescription.put("41","Quando um elemento de formul\u00E1rio receber o foco, n\u00E3o deve ser iniciada uma mudan\u00E7a autom\u00E1tica na p\u00E1gina que confunda ou desoriente o usu\u00E1rio. Assim, as mudan\u00E7as devem ocorrer atrav\u00E9s do acionamento de um bot\u00E3o.");
  65 + mapDescription.put("42","Para conte\u00FAdo que exigir entrada de dados por parte do usu\u00E1rio, devem ser fornecidas , quando necess\u00E1rio, instru\u00E7\u00F5es de preenchimento juntamente com as etiquetas (label).");
  66 + mapDescription.put("43","Quando um erro de entrada de dados for automaticamente detectado, o item que apresenta erro deve ser identificado e descrito ao usu\u00E1rio por texto.");
  67 + mapDescription.put("44","Dever\u00E3o ser agrupados os controles de formul\u00E1rio relacionados de maneira l\u00F3gica, utilizando-se o elemento fieldset, associando o elemento legend de forma significativa (o elemento fieldset \u00E9 \u00FAtil para agrupar, de forma l\u00F3gica, elementos do formul\u00E1rio). Para cada fieldset, \u00E9 poss\u00EDvel fornecer uma legenda que explica claramente o prop\u00F3sito ou natureza dos agrupamentos.");
  68 + mapDescription.put("45","O CAPTCHA (teste interativo humano, completamente automatizado, para distinguir computadores de seres humanos), quando utilizado, dever\u00E1 ser fornecido em forma de pergunta de interpreta\u00E7\u00E3o. Tais perguntas poder\u00E3o ser respondidas apenas por um ser humano. No entanto, \u00E9 preciso garantir que a pergunta n\u00E3o seja de dif\u00EDcil resolu\u00E7\u00E3o, permitindo que a mesma possa ser respondida por pessoas de variadas culturas e n\u00EDveis de instru\u00E7\u00E3o. Para tal, podem ser utilizadas perguntas de senso comum, como por exemplo, \u201Cqual \u00E9 a cor do c\u00E9u?\u201D ou \u201Co fogo \u00E9 quente ou frio?\u201D. Tamb\u00E9m podem ser utilizados testes matem\u00E1ticos. No entanto, \u00E9 preciso tomar cuidado para que esses testes n\u00E3o sejam facilmente \u201Cquebrados\u201D por determinados programas. Uma alternativa \u00E9 solicitar que o usu\u00E1rio escreva o resultado do teste matem\u00E1tico por extenso, como \u201Cescreva por extenso quanto \u00E9 2 + 3\u201D, ou ainda \u201Cresponda por extenso quanto \u00E9 dois mais tr\u00EAs\u201D.");
  69 +
  70 + }
  71 +
  72 + private SummarizedOccurrence(String checkPoint, boolean isError, Set<Integer> lines,
  73 + OccurrenceClassification type) {
  74 +
  75 + this.checkPoint = checkPoint;
  76 + this.isError = isError;
  77 + this.lines = lines;
  78 + this.type = type;
  79 + }
  80 +
  81 + public static class Builder{
  82 +
  83 + private String checkPoint;
  84 + private boolean isError;
  85 + private Set<Integer> lines = new HashSet<Integer>();
  86 + private OccurrenceClassification type;
  87 +
  88 + public Builder setCheckPoint(String checkPoint) {
  89 + this.checkPoint = checkPoint;
  90 + return this;
  91 + }
  92 +
  93 + public Builder setIsError(boolean isError) {
  94 + this.isError = isError;
  95 + return this;
  96 + }
  97 +
  98 + public Builder setType(OccurrenceClassification type){
  99 + this.type = type;
  100 + return this;
  101 + }
  102 +
  103 + public Builder addLine(Integer line) {
  104 +
  105 + if(line!=null)
  106 + this.lines.add(line);
  107 +
  108 + return this;
  109 + }
  110 +
  111 + public SummarizedOccurrence build() {
  112 + return new SummarizedOccurrence(this.checkPoint, this.isError, this.lines,this.type);
  113 + }
  114 + }
  115 +
  116 + public String getStringLines() {
  117 + StringBuilder linesString = new StringBuilder();
  118 +
  119 + for(Integer line : this.lines) {
  120 + linesString.append(line);
  121 + linesString.append(", ");
  122 + }
  123 +
  124 + return StringUtils.isEmpty(linesString.toString()) ? EMPTY_LINES : linesString.toString().substring(0, linesString.length() -2);
  125 + }
  126 +
  127 + public String getNumberOfOccurrences() { return this.lines.size() !=0 ? String.valueOf(this.lines.size()) : EMPTY_LINES ; }
  128 + public String getDescription() { return this.mapDescription.get(this.getCheckPoint()); }
  129 +
  130 + public int compareTo(SummarizedOccurrence other) { return Integer.valueOf(checkPoint).compareTo(Integer.valueOf(other.getCheckPoint())); }
  131 +
  132 +
  133 +}
... ...
src/main/java/br/com/checker/emag/core/BehaviorEvaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/BehaviorEvaluation.java
... ... @@ -0,0 +1,163 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import net.htmlparser.jericho.Attribute;
  7 +import net.htmlparser.jericho.Element;
  8 +import net.htmlparser.jericho.Source;
  9 +import br.com.checker.emag.Occurrence;
  10 +import br.com.checker.emag.OccurrenceClassification;
  11 +import br.com.checker.emag.core.SpecificRecommendation.BehaviorRecommendation;
  12 +
  13 +public class BehaviorEvaluation extends Evaluation{
  14 +
  15 + private BehaviorEvaluation(Source document) { super(document); }
  16 +
  17 + public static class BehaviorEvaluationBuilder extends EvaluationBuilder {
  18 +
  19 + @Override
  20 + protected BehaviorEvaluation with(Source document) { return new BehaviorEvaluation(document); }
  21 +
  22 + public SpecificRecommendation recommendation10() { return new EvaluationRecommendation10();}
  23 + public SpecificRecommendation recommendation11() { return new EvaluationRecommendation11();}
  24 + public SpecificRecommendation recommendation12() { return new EvaluationRecommendation12();}
  25 + public SpecificRecommendation recommendation13() { return new EvaluationRecommendation13();}
  26 + public SpecificRecommendation recommendation14() { return new EvaluationRecommendation14();}
  27 + public SpecificRecommendation recommendation15() { return new EvaluationRecommendation15();}
  28 + }
  29 +
  30 + protected static class EvaluationRecommendation10 extends BehaviorRecommendation{
  31 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation10();}
  32 + }
  33 +
  34 + protected static class EvaluationRecommendation11 extends BehaviorRecommendation{
  35 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation11();}
  36 + }
  37 +
  38 + protected static class EvaluationRecommendation12 extends BehaviorRecommendation{
  39 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation12();}
  40 + }
  41 +
  42 + protected static class EvaluationRecommendation13 extends BehaviorRecommendation{
  43 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation13();}
  44 + }
  45 +
  46 + protected static class EvaluationRecommendation14 extends BehaviorRecommendation{
  47 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation14();}
  48 + }
  49 +
  50 + protected static class EvaluationRecommendation15 extends BehaviorRecommendation{
  51 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation15();}
  52 + }
  53 +
  54 + public List<Occurrence> check() {
  55 + getOccurrences().clear();
  56 + getOccurrences().addAll(checkRecommendation10());
  57 + getOccurrences().addAll(checkRecommendation11());
  58 + getOccurrences().addAll(checkRecommendation12());
  59 + getOccurrences().addAll(checkRecommendation13());
  60 + getOccurrences().addAll(checkRecommendation14());
  61 + getOccurrences().addAll(checkRecommendation15());
  62 +
  63 + return getOccurrences();
  64 + }
  65 +
  66 +
  67 +
  68 + private List<Occurrence> checkRecommendation10() {
  69 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  70 +
  71 +
  72 + for (Element script : getDocument().getAllElements("script")) {
  73 + Element depois = this.getDocument().getNextElement(script.getEnd());
  74 +
  75 + if (depois == null || !depois.getName().equals("noscript"))
  76 + occurrences.add(this.buildOccurrence("10", true, script.toString(), script));
  77 + }
  78 +
  79 + for (Element video : this.getDocument().getAllElements("object"))
  80 + occurrences.add(this.buildOccurrence("10",true, video.toString(), video));
  81 +
  82 + return occurrences;
  83 + }
  84 +
  85 +
  86 +
  87 + private List<Occurrence> checkRecommendation11() {
  88 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  89 +
  90 + boolean temMetaRefresh = false;
  91 + for (Element element : getDocument().getAllElements("meta")) {
  92 + Attribute httpEquiv = element.getAttributes().get("http-equiv");
  93 +
  94 + if (httpEquiv != null && "refresh".equals(httpEquiv.getValue())) {
  95 + occurrences.add(this.buildOccurrence("11", true, element.toString(), element));
  96 + temMetaRefresh = true;
  97 + }
  98 + }
  99 +
  100 + if(!temMetaRefresh)
  101 + occurrences.add(new Occurrence("11", false, this.getDocument().getFirstElement().toString(),OccurrenceClassification.BEHAVIOR));
  102 +
  103 + return occurrences;
  104 + }
  105 +
  106 + private List<Occurrence> checkRecommendation12() {
  107 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  108 +
  109 + boolean temMetaRefresh = false;
  110 + for (Element element : getDocument().getAllElements("meta")) {
  111 + Attribute httpEquiv = element.getAttributes().get("http-equiv");
  112 +
  113 + if (httpEquiv != null && "refresh".equals(httpEquiv.getValue())) {
  114 + occurrences.add(this.buildOccurrence("12", true, element.toString(), element));
  115 + temMetaRefresh = true;
  116 + }
  117 + }
  118 +
  119 + if(!temMetaRefresh)
  120 + occurrences.add(new Occurrence("12", false, this.getDocument().getFirstElement().toString(),OccurrenceClassification.BEHAVIOR));
  121 +
  122 + return occurrences;
  123 + }
  124 +
  125 + private List<Occurrence> checkRecommendation13() {
  126 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  127 + occurrences.add(new Occurrence("13", false, this.getDocument().getFirstElement().toString(),OccurrenceClassification.BEHAVIOR));
  128 + return occurrences;
  129 + }
  130 +
  131 + private List<Occurrence> checkRecommendation14() {
  132 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  133 + boolean hasBlink = false;
  134 + boolean hasMarquee = false;
  135 + for (Element blink : getDocument().getAllElements("blink")) {
  136 + occurrences.add(this.buildOccurrence("14", true, blink.toString(), blink));
  137 + hasBlink = true;
  138 + }
  139 +
  140 + for(Element marquee : getDocument().getAllElements("marquee")) {
  141 + occurrences.add(this.buildOccurrence("14", true, marquee.toString(), marquee));
  142 + hasMarquee = true;
  143 + }
  144 +
  145 + if (!hasBlink && !hasMarquee)
  146 + occurrences.add(new Occurrence("14", false, getDocument().getFirstElement().toString(),OccurrenceClassification.BEHAVIOR));
  147 +
  148 + return occurrences;
  149 + }
  150 +
  151 + private List<Occurrence> checkRecommendation15() {
  152 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  153 + occurrences.add(new Occurrence("15", false, getDocument().getFirstElement().toString(),OccurrenceClassification.BEHAVIOR));
  154 + return occurrences;
  155 + }
  156 +
  157 + private Occurrence buildOccurrence(String code, boolean error,
  158 + String tag, Element element) {
  159 + return super.buildOccurrence(code, error, tag, element, OccurrenceClassification.BEHAVIOR);
  160 + }
  161 +
  162 + public OccurrenceClassification type () { return OccurrenceClassification.BEHAVIOR;}
  163 +}
... ...
src/main/java/br/com/checker/emag/core/Checker.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/Checker.java
... ... @@ -0,0 +1,132 @@
  1 +package br.com.checker.emag.core;
  2 +import java.io.BufferedReader;
  3 +import java.io.IOException;
  4 +import java.util.ArrayList;
  5 +import java.util.Collections;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +import java.util.Map.Entry;
  10 +
  11 +import lombok.EqualsAndHashCode;
  12 +import lombok.Getter;
  13 +import net.htmlparser.jericho.Source;
  14 +import br.com.checker.emag.Occurrence;
  15 +import br.com.checker.emag.OccurrenceClassification;
  16 +import br.com.checker.emag.SummarizedOccurrence;
  17 +import br.com.checker.emag.core.BehaviorEvaluation.BehaviorEvaluationBuilder;
  18 +import br.com.checker.emag.core.ContentEvaluation.ContentEvaluationBuilder;
  19 +import br.com.checker.emag.core.Evaluation.EvaluationBuilder;
  20 +import br.com.checker.emag.core.FormEvaluation.FormEvaluationBuilder;
  21 +import br.com.checker.emag.core.MarkEvaluation.MarkEvaluationBuilder;
  22 +import br.com.checker.emag.core.MultimediaEvaluation.MultimediaEvaluationBuilder;
  23 +import br.com.checker.emag.core.PresentationEvaluation.PresentationEvaluationBuilder;
  24 +
  25 +
  26 +
  27 +public class Checker {
  28 +
  29 + private Source document;
  30 + private Map<OccurrenceClassification,List<Occurrence>> occurrencesMap = new HashMap<OccurrenceClassification, List<Occurrence>>();;
  31 +
  32 + private Checker(String html) {
  33 +
  34 + this.document = new Source(html);
  35 + this.document.fullSequentialParse();
  36 + }
  37 +
  38 + public static Checker from(String html) { return new Checker(html); }
  39 +
  40 + public static Checker from(BufferedReader reader) throws IOException {
  41 +
  42 + String html = "";
  43 + String linha = "";
  44 + while( ( linha = reader.readLine() ) != null )
  45 + html += linha;
  46 +
  47 + return new Checker(html);
  48 + }
  49 +
  50 +
  51 + public static MarkEvaluationBuilder marking() { return new MarkEvaluationBuilder(); }
  52 + public static FormEvaluationBuilder form() { return new FormEvaluationBuilder(); }
  53 + public static BehaviorEvaluationBuilder behavior() { return new BehaviorEvaluationBuilder(); }
  54 + public static MultimediaEvaluationBuilder multimedia() { return new MultimediaEvaluationBuilder(); }
  55 + public static ContentEvaluationBuilder content() { return new ContentEvaluationBuilder(); }
  56 + public static PresentationEvaluationBuilder presentation() { return new PresentationEvaluationBuilder(); }
  57 +
  58 + public Checker with(EvaluationBuilder builder) {
  59 + Evaluation evaluation = builder.with(this.document);
  60 + occurrencesMap.put(evaluation.type(), evaluation.check());
  61 + return this;
  62 + }
  63 +
  64 + public Checker with(SpecificRecommendation evaluation){
  65 + evaluation.with(document);
  66 +
  67 + if(occurrencesMap.get(evaluation.type())!=null)
  68 + occurrencesMap.get(evaluation.type()).addAll(evaluation.check());
  69 + else
  70 + occurrencesMap.put(evaluation.type(), evaluation.check());
  71 +
  72 + return this;
  73 + }
  74 +
  75 + public Map<OccurrenceClassification,List<Occurrence>> check() { return this.occurrencesMap; }
  76 +
  77 + public List<SummarizedOccurrence> checkSumarized() {
  78 +
  79 + List<SummarizedOccurrence> list = new ArrayList<SummarizedOccurrence>();
  80 +
  81 + for(Entry<OccurrenceClassification, List<Occurrence>> entry :this.occurrencesMap.entrySet()) {
  82 +
  83 + for(Entry<OccurrenceKey, List<Occurrence>> entryGroupedOccurrence :groupOccurrencesByCode(entry.getValue()).entrySet()) {
  84 +
  85 + SummarizedOccurrence.Builder builder = new SummarizedOccurrence.Builder()
  86 + .setCheckPoint(entryGroupedOccurrence.getKey().getCode())
  87 + .setType(entry.getKey())
  88 + .setIsError(entryGroupedOccurrence.getKey().isError);
  89 +
  90 +
  91 + for(Occurrence occurrence : entryGroupedOccurrence.getValue())
  92 + builder.addLine(occurrence.getLine());
  93 +
  94 + list.add(builder.build());
  95 +
  96 + }
  97 + }
  98 + Collections.sort(list);
  99 + return list;
  100 + }
  101 +
  102 + private Map<OccurrenceKey,List<Occurrence>> groupOccurrencesByCode(List<Occurrence> occurrences) {
  103 +
  104 + Map<OccurrenceKey,List<Occurrence>> map = new HashMap<OccurrenceKey, List<Occurrence>>();
  105 + OccurrenceKey occurrenceKey = null;
  106 + for(Occurrence occurrence : occurrences) {
  107 + occurrenceKey = new OccurrenceKey(occurrence);
  108 +
  109 + if(map.get(occurrenceKey) ==null) {
  110 + map.put(occurrenceKey, new ArrayList<Occurrence>());
  111 + map.get(occurrenceKey).add(occurrence);
  112 + }else {
  113 + map.get(occurrenceKey).add(occurrence);
  114 + }
  115 +
  116 + }
  117 + return map;
  118 + }
  119 +
  120 +
  121 + @EqualsAndHashCode
  122 + private @Getter class OccurrenceKey {
  123 + private String code;
  124 + private boolean isError;
  125 +
  126 + public OccurrenceKey (Occurrence occurrence) {
  127 + this.code = occurrence.getCode();
  128 + this.isError = occurrence.isError();
  129 + }
  130 + }
  131 +
  132 +}
... ...
src/main/java/br/com/checker/emag/core/ContentEvaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/ContentEvaluation.java
... ... @@ -0,0 +1,362 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import org.apache.commons.lang3.StringUtils;
  7 +
  8 +import net.htmlparser.jericho.Attribute;
  9 +import net.htmlparser.jericho.Element;
  10 +import net.htmlparser.jericho.Source;
  11 +import br.com.checker.emag.Occurrence;
  12 +import br.com.checker.emag.OccurrenceClassification;
  13 +import br.com.checker.emag.core.SpecificRecommendation.ContentRecommendation;
  14 +
  15 +public class ContentEvaluation extends Evaluation{
  16 +
  17 + private ContentEvaluation(Source document) { super(document); }
  18 +
  19 + public static class ContentEvaluationBuilder extends EvaluationBuilder {
  20 +
  21 + @Override
  22 + protected ContentEvaluation with(Source document) { return new ContentEvaluation(document); }
  23 +
  24 + public SpecificRecommendation recommendation16() { return new EvaluationRecommendation16();}
  25 + public SpecificRecommendation recommendation17() { return new EvaluationRecommendation17();}
  26 + public SpecificRecommendation recommendation18() { return new EvaluationRecommendation18();}
  27 + public SpecificRecommendation recommendation19() { return new EvaluationRecommendation19();}
  28 + public SpecificRecommendation recommendation20() { return new EvaluationRecommendation20();}
  29 + public SpecificRecommendation recommendation21() { return new EvaluationRecommendation21();}
  30 + public SpecificRecommendation recommendation22() { return new EvaluationRecommendation22();}
  31 + public SpecificRecommendation recommendation23() { return new EvaluationRecommendation23();}
  32 + public SpecificRecommendation recommendation24() { return new EvaluationRecommendation24();}
  33 + public SpecificRecommendation recommendation25() { return new EvaluationRecommendation25();}
  34 + public SpecificRecommendation recommendation26() { return new EvaluationRecommendation26();}
  35 + public SpecificRecommendation recommendation27() { return new EvaluationRecommendation27();}
  36 +
  37 + }
  38 +
  39 + protected static class EvaluationRecommendation16 extends ContentRecommendation{
  40 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation16();}
  41 + }
  42 + protected static class EvaluationRecommendation17 extends ContentRecommendation{
  43 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation17();}
  44 + }
  45 + protected static class EvaluationRecommendation18 extends ContentRecommendation{
  46 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation18();}
  47 + }
  48 + protected static class EvaluationRecommendation19 extends ContentRecommendation{
  49 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation19();}
  50 + }
  51 + protected static class EvaluationRecommendation20 extends ContentRecommendation{
  52 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation20();}
  53 + }
  54 + protected static class EvaluationRecommendation21 extends ContentRecommendation{
  55 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation21();}
  56 + }
  57 + protected static class EvaluationRecommendation22 extends ContentRecommendation{
  58 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation22();}
  59 + }
  60 + protected static class EvaluationRecommendation23 extends ContentRecommendation{
  61 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation23();}
  62 + }
  63 + protected static class EvaluationRecommendation24 extends ContentRecommendation{
  64 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation24();}
  65 + }
  66 + protected static class EvaluationRecommendation25 extends ContentRecommendation{
  67 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation25();}
  68 + }
  69 + protected static class EvaluationRecommendation26 extends ContentRecommendation{
  70 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation26();}
  71 + }
  72 + protected static class EvaluationRecommendation27 extends ContentRecommendation{
  73 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation27();}
  74 + }
  75 +
  76 +
  77 + public List<Occurrence> check() {
  78 + getOccurrences().clear();
  79 + getOccurrences().addAll(checkRecommendation16());
  80 + getOccurrences().addAll(checkRecommendation17());
  81 + getOccurrences().addAll(checkRecommendation18());
  82 + getOccurrences().addAll(checkRecommendation19());
  83 + getOccurrences().addAll(checkRecommendation20());
  84 + getOccurrences().addAll(checkRecommendation21());
  85 + getOccurrences().addAll(checkRecommendation22());
  86 + getOccurrences().addAll(checkRecommendation23());
  87 + getOccurrences().addAll(checkRecommendation24());
  88 + getOccurrences().addAll(checkRecommendation25());
  89 + getOccurrences().addAll(checkRecommendation26());
  90 + getOccurrences().addAll(checkRecommendation27());
  91 +
  92 + return getOccurrences();
  93 + }
  94 +
  95 +
  96 +
  97 + private List<Occurrence> checkRecommendation16() {
  98 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  99 +
  100 + Element html = getDocument().getFirstElement("html");
  101 +
  102 + if (html != null) {
  103 + Attribute lang = html.getAttributes().get("lang");
  104 + Attribute xmlLang = html.getAttributes().get("xml:lang");
  105 +
  106 + if (lang == null && xmlLang == null) {
  107 + occurrences.add(this.buildOccurrence("16", true, html.toString(), html));
  108 + } else if (lang != null && lang.getValue().isEmpty()) {
  109 + occurrences.add(this.buildOccurrence("16", true, html.toString(), html));
  110 + } else if (xmlLang != null && xmlLang.getValue().isEmpty()) {
  111 + occurrences.add(buildOccurrence("16", true, html.toString(), html));
  112 + }
  113 + }
  114 +
  115 + return occurrences;
  116 + }
  117 +
  118 + private List<Occurrence> checkRecommendation17() {
  119 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  120 +
  121 + Element head = getDocument().getFirstElement("head");
  122 +
  123 + if(head == null) {
  124 + occurrences.add(new Occurrence("17", true, getDocument().getFirstElement().toString(),OccurrenceClassification.CONTENT_INFORMATION));
  125 + }else {
  126 +
  127 + Element title = head.getFirstElement("title");
  128 + if (title == null) {
  129 + occurrences.add(buildOccurrence("17", true, head.toString(), head));
  130 + } else if (title.isEmpty()) {
  131 + occurrences.add(buildOccurrence("17", true, title.toString(), title));
  132 + }
  133 + }
  134 +
  135 + return occurrences;
  136 + }
  137 +
  138 + private List<Occurrence> checkRecommendation18() {
  139 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  140 + occurrences.add(new Occurrence("18", false, getDocument().getFirstElement().toString(),OccurrenceClassification.CONTENT_INFORMATION));
  141 + return occurrences;
  142 + }
  143 +
  144 + private List<Occurrence> checkRecommendation19() {
  145 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  146 +
  147 + for (Element a : getDocument().getAllElements("a")) {
  148 + Attribute href = a.getAttributes().get("href");
  149 + Attribute name = a.getAttributes().get("name");
  150 + Attribute id = a.getAttributes().get("id");
  151 +
  152 + if (href == null && name == null && id == null) {
  153 + occurrences.add(buildOccurrence("19", true, a.toString(), a));
  154 +
  155 +
  156 + } else if(name != null){
  157 + String nameValue = name.getValue();
  158 + System.out.println("Name Value = "+nameValue);
  159 + boolean nameContemHref = false;
  160 +
  161 + if(!nameValue.toString().contains("#")){
  162 + nameValue = ("#"+nameValue);
  163 + }
  164 +
  165 + for (Element aHref : getDocument().getAllElements("a")) {
  166 + String hrefValue = aHref.getAttributeValue("href");
  167 + System.out.println(nameValue+"=="+hrefValue);
  168 +
  169 + if(nameValue.equals(hrefValue))
  170 + nameContemHref = true;
  171 + }
  172 +
  173 + if(!nameContemHref)
  174 + occurrences.add(buildOccurrence("19", true, a.toString(), a));
  175 + }
  176 +
  177 +
  178 + }
  179 +
  180 + return occurrences;
  181 + }
  182 +
  183 + private List<Occurrence> checkRecommendation20() {
  184 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  185 + for (Element img : getDocument().getAllElements("img")) {
  186 + Attribute alt = img.getAttributes().get("alt");
  187 + if (alt == null || StringUtils.isEmpty(alt.getValue()))
  188 + occurrences.add(buildOccurrence("20", true, img.toString(), img));
  189 + }
  190 +
  191 + return occurrences;
  192 + }
  193 +
  194 + private List<Occurrence> checkRecommendation21() {
  195 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  196 +
  197 + for (Element area : getDocument().getAllElements("area")) {
  198 + Attribute alt = area.getAttributes().get("alt");
  199 + if (alt == null) {
  200 + occurrences.add(buildOccurrence("21", true, area.toString(), area));
  201 + } else if (alt.getValue().equals("")) {
  202 + occurrences.add(buildOccurrence("21", true, area.toString(), area));
  203 + }
  204 + }
  205 + for (Element img : getDocument().getAllElements("img")) {
  206 + Attribute ismap = img.getAttributes().get("ismap");
  207 + if (ismap != null && ismap.getValue().equals("ismap")) {
  208 + occurrences.add(buildOccurrence("21", false, img.toString(), img));
  209 + }
  210 + }
  211 +
  212 + return occurrences;
  213 + }
  214 +
  215 + private List<Occurrence> checkRecommendation22() {
  216 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  217 +
  218 + for (Element a : getDocument().getAllElements("a")) {
  219 + Attribute href = a.getAttributes().get("href");
  220 + if (href != null) {
  221 + if (href.getValue().endsWith(".pdf"))
  222 + occurrences.add(buildOccurrence("22", false, a.toString(), a));
  223 + }
  224 + }
  225 +
  226 + return occurrences;
  227 + }
  228 +
  229 + private List<Occurrence> checkRecommendation23() {
  230 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  231 +
  232 + for (Element table : getDocument().getAllElements("table")) {
  233 + Element caption = table.getFirstElement("caption");
  234 + Attribute summary = table.getAttributes().get("summary");
  235 +
  236 + if (caption == null) {
  237 + occurrences.add(buildOccurrence("23", true, table .toString().split("[\\r\\n]+")[0], table));
  238 + } else if (caption.getAllElements().isEmpty() || caption.isEmpty()) {
  239 + occurrences.add(buildOccurrence("23", true, caption.toString(), caption));
  240 + }
  241 +
  242 + if (summary == null) {
  243 + occurrences.add(buildOccurrence("23", true, table.toString().split("[\\r\\n]+")[0], table));
  244 + } else if (summary.getValue().isEmpty()) {
  245 + occurrences.add(buildOccurrence("23", true, table.toString().split("[\\r\\n]+")[0], table));
  246 + }
  247 + }
  248 +
  249 +
  250 + return occurrences;
  251 + }
  252 +
  253 + private List<Occurrence> checkRecommendation24() {
  254 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  255 +
  256 + for (Element table : getDocument().getAllElements("table")) {
  257 + Attribute summary = table.getAttributes().get("summary");
  258 + boolean THusaScope = false;
  259 + boolean THusaId = false;
  260 + boolean THusaHeaders = false;
  261 + boolean TDusaScope = false;
  262 + boolean TDusaId= false;
  263 + boolean TDusaHeaders = false;
  264 + boolean usaThead = false;
  265 + boolean usaTfoot = false;
  266 + boolean usaTbody = false;
  267 +
  268 + if (summary == null || summary.getValue().equals(""))
  269 + occurrences.add(buildOccurrence("24", true, table.toString(), table));
  270 +
  271 + for (Element thead : table.getAllElements("thead")) {
  272 + if (thead != null)
  273 + usaThead = true;
  274 + }
  275 +
  276 + for (Element tfoot : table.getAllElements("tfoot")) {
  277 + if (tfoot != null)
  278 + usaTfoot = true;
  279 + }
  280 +
  281 + for (Element tbody : table.getAllElements("tbody")) {
  282 + if (tbody != null)
  283 + usaTbody = true;
  284 + }
  285 +
  286 + if(!usaThead && !usaTbody && !usaTfoot){
  287 +
  288 + for (Element th : table.getAllElements("th")) {
  289 + Attribute scope = th.getAttributes().get("scope");
  290 + Attribute headers = th.getAttributes().get("headers");
  291 + Attribute id = th.getAttributes().get("id");
  292 + if (scope != null && !scope.getValue().equals("")) {
  293 + THusaScope = true;
  294 + } else if (headers != null && !headers.getValue().equals("")) {
  295 + THusaHeaders = true;
  296 + } else if (id != null && !id.getValue().equals("")) {
  297 + THusaId = true;
  298 + }
  299 +
  300 + if(!THusaScope && !THusaHeaders && !THusaId){
  301 + occurrences.add(buildOccurrence("24", true, th.toString(), th));
  302 + }
  303 + }
  304 +
  305 + for (Element td : table.getAllElements("td")) {
  306 + Attribute tdscope = td.getAttributes().get("scope");
  307 + Attribute tdheaders = td.getAttributes().get("headers");
  308 + Attribute tdid = td.getAttributes().get("id");
  309 + if (tdscope != null && !tdscope.getValue().equals("")) {
  310 + TDusaScope = true;
  311 + } else if (tdheaders != null && !tdheaders.getValue().equals("")) {
  312 + TDusaHeaders = true;
  313 + } else if (tdid != null && !tdid.getValue().equals("")) {
  314 + TDusaId = true;
  315 + }
  316 +
  317 + if(!TDusaScope && !TDusaHeaders && !TDusaId){
  318 + occurrences.add(buildOccurrence("24", true, td.toString(), td));
  319 + }
  320 + }
  321 +
  322 + }
  323 +
  324 +
  325 + }
  326 +
  327 + return occurrences;
  328 + }
  329 +
  330 + private List<Occurrence> checkRecommendation25() {
  331 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  332 + occurrences.add(new Occurrence("25", false, getDocument().getFirstElement().toString(),OccurrenceClassification.CONTENT_INFORMATION));
  333 + return occurrences;
  334 + }
  335 +
  336 + private List<Occurrence> checkRecommendation26() {
  337 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  338 +
  339 + for (Element abbr : getDocument().getAllElements("abbr")) {
  340 + Attribute title = abbr.getAttributes().get("title");
  341 + if(title == null || title.getValue().equals(""))
  342 + occurrences.add(buildOccurrence("26", true, abbr.toString(), abbr));
  343 + else
  344 + occurrences.add(buildOccurrence("26", false, abbr.toString(), abbr));
  345 + }
  346 +
  347 + return occurrences;
  348 + }
  349 +
  350 + private List<Occurrence> checkRecommendation27() {
  351 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  352 + occurrences.add(new Occurrence("27", false, getDocument().getFirstElement().toString(),OccurrenceClassification.CONTENT_INFORMATION));
  353 + return occurrences;
  354 + }
  355 +
  356 + private Occurrence buildOccurrence(String code, boolean error,
  357 + String tag, Element element) {
  358 + return super.buildOccurrence(code, error, tag, element, OccurrenceClassification.CONTENT_INFORMATION);
  359 + }
  360 +
  361 + public OccurrenceClassification type () { return OccurrenceClassification.CONTENT_INFORMATION;}
  362 +}
... ...
src/main/java/br/com/checker/emag/core/Evaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/Evaluation.java
... ... @@ -0,0 +1,39 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import br.com.checker.emag.Occurrence;
  7 +import br.com.checker.emag.OccurrenceClassification;
  8 +
  9 +import lombok.AccessLevel;
  10 +import lombok.Getter;
  11 +import net.htmlparser.jericho.Element;
  12 +import net.htmlparser.jericho.RowColumnVector;
  13 +import net.htmlparser.jericho.Source;
  14 +
  15 +public abstract class Evaluation {
  16 +
  17 + @Getter(AccessLevel.PROTECTED) private Source document;
  18 + @Getter(AccessLevel.PROTECTED) private List<Occurrence> occurrences;
  19 +
  20 + protected Evaluation(Source document) {
  21 + this.document = document;
  22 + this.occurrences = new ArrayList<Occurrence>();
  23 + }
  24 +
  25 + protected Occurrence buildOccurrence(String code,boolean error,String tag, Element element,OccurrenceClassification type) {
  26 + RowColumnVector rcv = this.document.getRowColumnVector(element.getBegin());
  27 + int line = rcv.getRow();
  28 + int column = rcv.getColumn();
  29 +
  30 + return new Occurrence(line, column, code, error, tag,type);
  31 + }
  32 +
  33 + public abstract OccurrenceClassification type ();
  34 + public abstract List<Occurrence> check();
  35 +
  36 + protected static abstract class EvaluationBuilder {
  37 + protected abstract Evaluation with(Source document);
  38 + }
  39 +}
... ...
src/main/java/br/com/checker/emag/core/FormEvaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/FormEvaluation.java
... ... @@ -0,0 +1,379 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import net.htmlparser.jericho.Attribute;
  7 +import net.htmlparser.jericho.Element;
  8 +import net.htmlparser.jericho.Source;
  9 +import br.com.checker.emag.Occurrence;
  10 +import br.com.checker.emag.OccurrenceClassification;
  11 +import br.com.checker.emag.core.SpecificRecommendation.FormRecommendation;
  12 +
  13 +public class FormEvaluation extends Evaluation{
  14 +
  15 + private FormEvaluation(Source document) { super(document); }
  16 +
  17 + public static class FormEvaluationBuilder extends EvaluationBuilder {
  18 +
  19 + @Override
  20 + protected FormEvaluation with(Source document) { return new FormEvaluation(document); }
  21 +
  22 + public SpecificRecommendation recommendation38() { return new EvaluationRecommendation38();}
  23 + public SpecificRecommendation recommendation39() { return new EvaluationRecommendation39();}
  24 + public SpecificRecommendation recommendation40() { return new EvaluationRecommendation40();}
  25 + public SpecificRecommendation recommendation41() { return new EvaluationRecommendation41();}
  26 + public SpecificRecommendation recommendation42() { return new EvaluationRecommendation42();}
  27 + public SpecificRecommendation recommendation43() { return new EvaluationRecommendation43();}
  28 + public SpecificRecommendation recommendation44() { return new EvaluationRecommendation44();}
  29 + public SpecificRecommendation recommendation45() { return new EvaluationRecommendation45();}
  30 + }
  31 +
  32 + protected static class EvaluationRecommendation38 extends FormRecommendation{
  33 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation38();}
  34 + }
  35 +
  36 + protected static class EvaluationRecommendation39 extends FormRecommendation{
  37 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation39();}
  38 + }
  39 +
  40 + protected static class EvaluationRecommendation40 extends FormRecommendation{
  41 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation40();}
  42 + }
  43 +
  44 + protected static class EvaluationRecommendation41 extends FormRecommendation{
  45 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation41();}
  46 + }
  47 +
  48 + protected static class EvaluationRecommendation42 extends FormRecommendation{
  49 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation42();}
  50 + }
  51 +
  52 + protected static class EvaluationRecommendation43 extends FormRecommendation{
  53 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation43();}
  54 + }
  55 +
  56 + protected static class EvaluationRecommendation44 extends FormRecommendation{
  57 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation44();}
  58 + }
  59 +
  60 + protected static class EvaluationRecommendation45 extends FormRecommendation{
  61 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation45();}
  62 + }
  63 +
  64 + public List<Occurrence> check() {
  65 + getOccurrences().clear();
  66 + getOccurrences().addAll(checkRecommendation38());
  67 + getOccurrences().addAll(checkRecommendation39());
  68 + getOccurrences().addAll(checkRecommendation40());
  69 + getOccurrences().addAll(checkRecommendation41());
  70 + getOccurrences().addAll(checkRecommendation42());
  71 + getOccurrences().addAll(checkRecommendation43());
  72 + getOccurrences().addAll(checkRecommendation44());
  73 + getOccurrences().addAll(checkRecommendation45());
  74 +
  75 + return getOccurrences();
  76 + }
  77 +
  78 +
  79 +
  80 + private List<Occurrence> checkRecommendation38() {
  81 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  82 +
  83 + for (Element input : this.getDocument().getAllElements("input")) {
  84 + Attribute type = input.getAttributes().get("type");
  85 + if (type != null) {
  86 + if (type.getValue().equals("image")) {
  87 + Attribute alt = input.getAttributes().get("alt");
  88 + if (alt == null || alt.getValue().isEmpty()) {
  89 + occurrences.add(this.buildOccurrence("38", true, input.toString(), input));
  90 + }
  91 + }
  92 + if (type.getValue().equals("submit") || type.getValue().equals("reset") || type.getValue().equals("button")) {
  93 + Attribute value = input.getAttributes().get("value");
  94 + if (value == null || value.getValue().isEmpty()) {
  95 + occurrences.add(this.buildOccurrence("38", true,input.toString(), input));
  96 + }
  97 + }
  98 + }
  99 + }
  100 + return occurrences;
  101 + }
  102 +
  103 + private List<Occurrence> checkRecommendation39() {
  104 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  105 +
  106 + for (Element form : this.getDocument().getAllElements("form")) {
  107 + for (Element label : form.getAllElements("label")) {
  108 + Attribute attrFor = label.getAttributes().get("for");
  109 + if (attrFor == null || attrFor.getValue().isEmpty()) {
  110 + occurrences.add(this.buildOccurrence("39", true, label.toString(), label));
  111 + } else {
  112 + boolean temInputEquivalente = false;
  113 + for (Element input : form.getAllElements("input")) {
  114 + Attribute id = input.getAttributes().get("id");
  115 + if (id != null && id.getValue().equals(attrFor.getValue())) {
  116 + temInputEquivalente = true;
  117 + break;
  118 + }
  119 + }
  120 +
  121 + for (Element input : form.getAllElements("textarea")) {
  122 + Attribute id = input.getAttributes().get("id");
  123 + if (id != null && id.getValue().equals(attrFor.getValue())) {
  124 + temInputEquivalente = true;
  125 + break;
  126 + }
  127 + }
  128 +
  129 + if (!temInputEquivalente) {
  130 + occurrences.add(this.buildOccurrence("39", true, label.toString(), label));
  131 + }
  132 + }
  133 + }
  134 +
  135 + for (Element input : form.getAllElements("input")) {
  136 + Attribute type = input.getAttributes().get("type");
  137 + if (type != null) {
  138 + if (type.getValue().equals("submit") ||
  139 + type.getValue().equals("reset") ||
  140 + type.getValue().equals("button") ||
  141 + type.getValue().equals("image") ||
  142 + type.getValue().equals("hidden")) {
  143 + continue;
  144 + }
  145 + }
  146 + Attribute attrId = input.getAttributes().get("id");
  147 + if (attrId == null || attrId.getValue().isEmpty()) {
  148 + System.out.println("TAG COMPLETA: "+input.toString());
  149 + occurrences.add(this.buildOccurrence("39", true,input.toString(), input));
  150 + } else {
  151 + boolean temLabelEquivalente = false;
  152 + for (Element label : form.getAllElements("label")) {
  153 + Attribute attrFor = label.getAttributes().get("for");
  154 + if (attrFor != null && attrFor.getValue().equals(attrId.getValue())) {
  155 + temLabelEquivalente = true;
  156 + break;
  157 + }
  158 + }
  159 + if (!temLabelEquivalente) {
  160 + occurrences.add(this.buildOccurrence("39", true, input.toString(), input));
  161 + }
  162 + }
  163 + }
  164 +
  165 + for (Element input : form.getAllElements("textarea")) {
  166 +
  167 + Attribute attrId = input.getAttributes().get("id");
  168 + if (attrId == null || attrId.getValue().isEmpty()) {
  169 + System.out.println("TAG COMPLETA: "+input.toString());
  170 + occurrences.add(this.buildOccurrence("39", true, input.toString(), input));
  171 + } else {
  172 + boolean temLabelEquivalente = false;
  173 + for (Element label : form.getAllElements("label")) {
  174 + Attribute attrFor = label.getAttributes().get("for");
  175 + if (attrFor != null && attrFor.getValue().equals(attrId.getValue())) {
  176 + temLabelEquivalente = true;
  177 + break;
  178 + }
  179 + }
  180 + if (!temLabelEquivalente) {
  181 + occurrences.add(this.buildOccurrence("39", true, input.toString(), input));
  182 + }
  183 + }
  184 + }
  185 +
  186 +
  187 +
  188 + }
  189 +
  190 + return occurrences;
  191 + }
  192 +
  193 + private List<Occurrence> checkRecommendation40() {
  194 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  195 + for(Element input : this.getDocument().getAllElements("input")){
  196 + Attribute t = input.getAttributes().get("tabindex");
  197 + if(t!=null){
  198 + occurrences.add(this.buildOccurrence("40", false, input.toString(), input));
  199 + }
  200 + }
  201 +
  202 + return occurrences;
  203 + }
  204 +
  205 + private List<Occurrence> checkRecommendation41() {
  206 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  207 +
  208 + for (Element elemento : this.getDocument().getAllElements()) {
  209 + Attribute onChange = null;
  210 + if (elemento.getAttributes() != null) {
  211 + onChange = elemento.getAttributes().get("onchange");
  212 + }
  213 + if (onChange != null) {
  214 + occurrences.add(this.buildOccurrence("41", true, elemento
  215 + .toString(), elemento));
  216 + }
  217 +
  218 + Attribute onBlur = null;
  219 + if (elemento.getAttributes() != null) {
  220 + onBlur = elemento.getAttributes().get("onblur");
  221 + }
  222 + if (onBlur != null) {
  223 + occurrences.add(this.buildOccurrence("41", true, elemento
  224 + .toString(), elemento));
  225 + }
  226 +
  227 + Attribute onFocus = null;
  228 + if (elemento.getAttributes() != null) {
  229 + onFocus = elemento.getAttributes().get("onfocus");
  230 + }
  231 + if (onFocus != null) {
  232 + occurrences.add(this.buildOccurrence("41", true, elemento
  233 + .toString(), elemento));
  234 + }
  235 +
  236 + Attribute onSelect = null;
  237 + if (elemento.getAttributes() != null) {
  238 + onSelect = elemento.getAttributes().get("onselect");
  239 + }
  240 + if (onSelect != null) {
  241 + occurrences.add(this.buildOccurrence("41", true, elemento
  242 + .toString(), elemento));
  243 + }
  244 +
  245 + Attribute onSubmit = null;
  246 + if (elemento.getAttributes() != null) {
  247 + onSubmit = elemento.getAttributes().get("onsubmit");
  248 + }
  249 + if (onSubmit != null) {
  250 + occurrences.add(this.buildOccurrence("41", true, elemento
  251 + .toString(), elemento));
  252 + }
  253 +
  254 + }
  255 +
  256 + return occurrences;
  257 + }
  258 +
  259 + private List<Occurrence> checkRecommendation42() {
  260 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  261 +
  262 + for (Element form : this.getDocument().getAllElements("form")) {
  263 +
  264 + for (Element input : form.getAllElements("input")) {
  265 + Attribute type = input.getAttributes().get("type");
  266 + if (type != null) {
  267 + if (type.getValue().equals("submit") ||
  268 + type.getValue().equals("reset") ||
  269 + type.getValue().equals("button") ||
  270 + type.getValue().equals("image") ||
  271 + type.getValue().equals("hidden")) {
  272 + continue;
  273 + }
  274 + }
  275 + Attribute attrId = input.getAttributes().get("id");
  276 + if (attrId == null || attrId.getValue().isEmpty()) {
  277 + System.out.println("TAG COMPLETA: "+input.toString());
  278 + occurrences.add(this.buildOccurrence("42", true, input.toString(), input));
  279 + } else {
  280 + boolean temLabelEquivalente = false;
  281 + for (Element label : form.getAllElements("label")) {
  282 + Attribute attrFor = label.getAttributes().get("for");
  283 + if (attrFor != null && attrFor.getValue().equals(attrId.getValue())) {
  284 + temLabelEquivalente = true;
  285 + break;
  286 + }
  287 + }
  288 + if (!temLabelEquivalente) {
  289 + occurrences.add(this.buildOccurrence("42", true, input.toString(), input));
  290 + }
  291 + }
  292 + }
  293 +
  294 + for (Element input : form.getAllElements("textarea")) {
  295 +
  296 + Attribute attrId = input.getAttributes().get("id");
  297 + if (attrId == null || attrId.getValue().isEmpty()) {
  298 + System.out.println("TAG COMPLETA: "+input.toString());
  299 + occurrences.add(this.buildOccurrence("42", true, input.toString(), input));
  300 + } else {
  301 + boolean temLabelEquivalente = false;
  302 + for (Element label : form.getAllElements("label")) {
  303 + Attribute attrFor = label.getAttributes().get("for");
  304 + if (attrFor != null && attrFor.getValue().equals(attrId.getValue())) {
  305 + temLabelEquivalente = true;
  306 + break;
  307 + }
  308 + }
  309 + if (!temLabelEquivalente) {
  310 + occurrences.add(this.buildOccurrence("42", true, input.toString(), input));
  311 + }
  312 + }
  313 + }
  314 + }
  315 +
  316 + return occurrences;
  317 + }
  318 +
  319 +
  320 + private List<Occurrence> checkRecommendation43() {
  321 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  322 + for (Element form : this.getDocument().getAllElements("form")) {
  323 + occurrences.add(this.buildOccurrence("43", false, form
  324 + .toString(), form));
  325 + }
  326 +
  327 + return occurrences;
  328 + }
  329 +
  330 + private List<Occurrence> checkRecommendation44() {
  331 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  332 +
  333 + for (Element form : this.getDocument().getAllElements("form")) {
  334 + if (form.getAllElements("fieldset").isEmpty()) {
  335 + occurrences.add(this.buildOccurrence("44", false, form
  336 + .toString(), form));
  337 + } else {
  338 + for (Element fieldset : form.getAllElements("fieldset")) {
  339 + if (fieldset.getAllElements("legend").isEmpty()) {
  340 + occurrences.add(this.buildOccurrence("44", true,
  341 + fieldset.toString(), fieldset));
  342 + }
  343 + }
  344 + }
  345 + for (Element select : form.getAllElements("select")) {
  346 + if (select.getAllElements("optgroup").isEmpty()) {
  347 + occurrences.add(this.buildOccurrence("44", false, select
  348 + .toString(), select));
  349 + } else {
  350 + for (Element optgroup : select.getAllElements("optgroup")) {
  351 + Attribute label = optgroup.getAttributes().get("label");
  352 + if (label == null || label.getValue().equals("")) {
  353 + occurrences.add(this.buildOccurrence("44", true,
  354 + optgroup.toString(), optgroup));
  355 + }
  356 + }
  357 + }
  358 + }
  359 + }
  360 +
  361 + return occurrences;
  362 + }
  363 +
  364 + private List<Occurrence> checkRecommendation45() {
  365 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  366 +
  367 + for (Element form : this.getDocument().getAllElements("form"))
  368 + occurrences.add(this.buildOccurrence("45", false, form.toString(), form));
  369 +
  370 + return occurrences;
  371 + }
  372 +
  373 + private Occurrence buildOccurrence(String code, boolean error,
  374 + String tag, Element element) {
  375 + return super.buildOccurrence(code, error, tag, element, OccurrenceClassification.FORM);
  376 + }
  377 +
  378 + public OccurrenceClassification type () { return OccurrenceClassification.FORM;}
  379 +}
... ...
src/main/java/br/com/checker/emag/core/MarkEvaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/MarkEvaluation.java
... ... @@ -0,0 +1,311 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import net.htmlparser.jericho.Attribute;
  7 +import net.htmlparser.jericho.Element;
  8 +import net.htmlparser.jericho.Source;
  9 +import net.htmlparser.jericho.StartTagType;
  10 +import net.htmlparser.jericho.Tag;
  11 +import br.com.checker.emag.Occurrence;
  12 +import br.com.checker.emag.OccurrenceClassification;
  13 +import br.com.checker.emag.core.SpecificRecommendation.MarkRecommendation;
  14 +
  15 +public class MarkEvaluation extends Evaluation {
  16 +
  17 + private MarkEvaluation(Source document) { super(document); }
  18 +
  19 + public static class MarkEvaluationBuilder extends EvaluationBuilder {
  20 +
  21 + @Override
  22 + protected MarkEvaluation with(Source document) { return new MarkEvaluation(document); }
  23 +
  24 + public SpecificRecommendation recommendation1() { return new EvaluationRecommendation1();}
  25 + public SpecificRecommendation recommendation2() { return new EvaluationRecommendation2();}
  26 + public SpecificRecommendation recommendation3() { return new EvaluationRecommendation3();}
  27 + public SpecificRecommendation recommendation4() { return new EvaluationRecommendation4();}
  28 + public SpecificRecommendation recommendation5() { return new EvaluationRecommendation5();}
  29 + public SpecificRecommendation recommendation6() { return new EvaluationRecommendation6();}
  30 + public SpecificRecommendation recommendation7() { return new EvaluationRecommendation7();}
  31 + public SpecificRecommendation recommendation8() { return new EvaluationRecommendation8();}
  32 + public SpecificRecommendation recommendation9() { return new EvaluationRecommendation9();}
  33 + }
  34 +
  35 + protected static class EvaluationRecommendation1 extends MarkRecommendation{
  36 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation1();}
  37 + }
  38 +
  39 + protected static class EvaluationRecommendation2 extends MarkRecommendation{
  40 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation2();}
  41 + }
  42 +
  43 + protected static class EvaluationRecommendation3 extends MarkRecommendation{
  44 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation3();}
  45 + }
  46 +
  47 + protected static class EvaluationRecommendation4 extends MarkRecommendation{
  48 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation4();}
  49 + }
  50 +
  51 + protected static class EvaluationRecommendation5 extends MarkRecommendation{
  52 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation5();}
  53 + }
  54 +
  55 + protected static class EvaluationRecommendation6 extends MarkRecommendation{
  56 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation6();}
  57 + }
  58 +
  59 + protected static class EvaluationRecommendation7 extends MarkRecommendation{
  60 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation7();}
  61 + }
  62 +
  63 + protected static class EvaluationRecommendation8 extends MarkRecommendation{
  64 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation8();}
  65 + }
  66 +
  67 + protected static class EvaluationRecommendation9 extends MarkRecommendation{
  68 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation9();}
  69 + }
  70 +
  71 +
  72 + public List<Occurrence> check() {
  73 + getOccurrences().addAll(checkRecommendation1());
  74 + getOccurrences().addAll(checkRecommendation2());
  75 + getOccurrences().addAll(checkRecommendation3());
  76 + getOccurrences().addAll(checkRecommendation4());
  77 + getOccurrences().addAll(checkRecommendation5());
  78 + getOccurrences().addAll(checkRecommendation6());
  79 + getOccurrences().addAll(checkRecommendation7());
  80 + getOccurrences().addAll(checkRecommendation8());
  81 + getOccurrences().addAll(checkRecommendation9());
  82 +
  83 + return getOccurrences();
  84 + }
  85 +
  86 + private List<Occurrence> checkRecommendation1() {
  87 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  88 + Tag docType = getDocument().getFirstStartTag(StartTagType.DOCTYPE_DECLARATION);
  89 +
  90 + if (docType == null || !docType.toString().contains("http"))
  91 + occurrences.add(this.buildOccurrence("1", true,"doctype",getDocument().getFirstElement()));
  92 +
  93 + return occurrences;
  94 + }
  95 +
  96 + private List<Occurrence> checkRecommendation2() {
  97 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  98 + occurrences.add(new Occurrence("2", false,this.getDocument().getFirstElement().toString(),OccurrenceClassification.MARK));
  99 +
  100 + return occurrences;
  101 + }
  102 +
  103 + private List<Occurrence> checkRecommendation3() {
  104 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  105 + int cont = 0;
  106 +
  107 + for (Element element : getDocument().getAllElements("h1")){
  108 + if(cont>0)
  109 + occurrences.add(this.buildOccurrence("3", false,element.toString(), element));
  110 + else
  111 + cont++;
  112 + }
  113 +
  114 + for (Element elemento2 : getDocument().getAllElements("h2")){
  115 + if(getDocument().getAllElements("h1").size()<1)
  116 + occurrences.add(this.buildOccurrence("3", false, elemento2.toString(), elemento2));
  117 + }
  118 +
  119 + for (Element elemento3 : getDocument().getAllElements("h3")){
  120 + if(getDocument().getAllElements("h2").size()<1)
  121 + occurrences.add(this.buildOccurrence("3", false, elemento3.toString(), elemento3));
  122 + }
  123 +
  124 + for (Element elemento4 : getDocument().getAllElements("h4")){
  125 + if(getDocument().getAllElements("h3").size()<1)
  126 + occurrences.add(this.buildOccurrence("3", false, elemento4.toString(), elemento4));
  127 + }
  128 +
  129 + for (Element elemento5 : getDocument().getAllElements("h5")){
  130 + if(getDocument().getAllElements("h4").size()<1)
  131 + occurrences.add(this.buildOccurrence("3", false,elemento5.toString(), elemento5));
  132 + }
  133 +
  134 + for (Element elemento6 : getDocument().getAllElements("h6")){
  135 + if(getDocument().getAllElements("h5").size()<1)
  136 + occurrences.add(this.buildOccurrence("3", false, elemento6.toString(), elemento6));
  137 + }
  138 + return occurrences;
  139 + }
  140 +
  141 + private List<Occurrence> checkRecommendation4() {
  142 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  143 +
  144 + for(Element link : this.getDocument().getAllElements("a")){
  145 + Attribute tabIndex = link.getAttributes().get("tabindex");
  146 + if(tabIndex!=null)
  147 + occurrences.add(this.buildOccurrence("4", false,link.toString(), link));
  148 + }
  149 +
  150 + for(Element input : this.getDocument().getAllElements("input")){
  151 +
  152 + Attribute tabIndex = input.getAttributes().get("tabindex");
  153 + if(tabIndex!=null)
  154 + occurrences.add(this.buildOccurrence("4", false, input.toString(), input));
  155 + }
  156 +
  157 + for(Element select : this.getDocument().getAllElements("select")){
  158 +
  159 + Attribute tabIndex = select.getAttributes().get("tabindex");
  160 + if(tabIndex!=null)
  161 + occurrences.add(this.buildOccurrence("4", false, select.toString(), select));
  162 + }
  163 +
  164 + for(Element textarea : this.getDocument().getAllElements("textarea")){
  165 +
  166 + Attribute tabIndex = textarea.getAttributes().get("tabindex");
  167 + if(tabIndex!=null)
  168 + occurrences.add(this.buildOccurrence("4", false, textarea.toString(), textarea));
  169 + }
  170 +
  171 + return occurrences;
  172 + }
  173 +
  174 +
  175 + private List<Occurrence> checkRecommendation5() {
  176 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  177 +
  178 + for (Element element : getDocument().getAllElements()) {
  179 +
  180 + Attribute onmousedown = null,onkeydown = null,
  181 + onmouseup = null, onkeyup = null,
  182 + onclick = null, onkeypress = null,
  183 + onmouseover = null,onfocus = null,
  184 + onmouseout = null, onblur = null;
  185 +
  186 + if (element.getAttributes() != null) {
  187 + onmousedown = element.getAttributes().get("onmousedown");
  188 + onkeydown = element.getAttributes().get("onkeydown");
  189 +
  190 + onmouseup = element.getAttributes().get("onmouseup");
  191 + onkeyup = element.getAttributes().get("onkeyup");
  192 +
  193 + onclick = element.getAttributes().get("onclick");
  194 + onkeypress = element.getAttributes().get("onkeypress");
  195 +
  196 + onmouseover = element.getAttributes().get("onmouseover");
  197 + onfocus = element.getAttributes().get("onfocus");
  198 +
  199 + onmouseout = element.getAttributes().get("onmouseout");
  200 + onblur = element.getAttributes().get("onblur");
  201 + }
  202 +
  203 + if (onmousedown != null && onkeydown == null) {
  204 + occurrences.add(this.buildOccurrence("5", true, element.toString(), element));
  205 +
  206 + } else if (onmouseup != null && onkeyup == null) {
  207 + occurrences.add(this.buildOccurrence("5", true, element.toString(), element));
  208 +
  209 + } else if (onclick != null && onkeypress == null) {
  210 + occurrences.add(this.buildOccurrence("5", true, element.toString(), element));
  211 +
  212 + } else if (onmouseover != null && onfocus == null) {
  213 + occurrences.add(this.buildOccurrence("5", true, element.toString(), element));
  214 +
  215 + } else if (onmouseout != null && onblur == null) {
  216 + occurrences.add(this.buildOccurrence("5", true, element.toString(), element));
  217 + }
  218 + }
  219 +
  220 + return occurrences;
  221 + }
  222 +
  223 + public List<Occurrence> checkRecommendation6() {
  224 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  225 +
  226 + Element html = getDocument().getFirstElement("html");
  227 + if (html != null) {
  228 + int anchors = 0;
  229 + for (Element link : getDocument().getAllElements("a")) {
  230 + String hrefValue = link.getAttributeValue("href");
  231 + if (hrefValue != null && !hrefValue.isEmpty() && hrefValue.startsWith("#"))
  232 + anchors++;
  233 + }
  234 +
  235 + if (anchors == 0)
  236 + occurrences.add(this.buildOccurrence("6", false, html.toString(), html));
  237 + }
  238 + return occurrences;
  239 + }
  240 +
  241 + public List<Occurrence> checkRecommendation7() {
  242 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  243 + for (Element table : getDocument().getAllElements("table"))
  244 + occurrences.add(this.buildOccurrence("7", false, table.toString(), table));
  245 +
  246 + return occurrences;
  247 + }
  248 +
  249 + public List<Occurrence> checkRecommendation8() {
  250 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  251 + Element link = null;
  252 +
  253 + for (Element element :getDocument().getAllElements()) {
  254 +
  255 + if(isLinkChild(element))
  256 + continue;
  257 +
  258 + if (link != null && element.getStartTag().toString().contains("<a"))
  259 + occurrences.add(this.buildOccurrence("8", true, link.toString(), link));
  260 + else
  261 + link = null;
  262 +
  263 + if (element.getEndTag() != null && element.getEndTag().toString().equals("</a>"))
  264 + link = element;
  265 + else
  266 + link = null;
  267 + }
  268 + return occurrences;
  269 + }
  270 +
  271 + public List<Occurrence> checkRecommendation9() {
  272 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  273 + boolean hasBlankLink = false;
  274 +
  275 + for (Element link : getDocument().getAllElements("a")) {
  276 +
  277 + if(link.toString().contains("_blank")){
  278 + hasBlankLink = true;
  279 + occurrences.add(this.buildOccurrence("9", true, link.toString(), link));
  280 + }
  281 + }
  282 +
  283 + if(!hasBlankLink)
  284 + occurrences.add(new Occurrence("9", false,this.getDocument().getFirstElement().toString(),OccurrenceClassification.MARK));
  285 +
  286 + return occurrences;
  287 + }
  288 +
  289 +
  290 + private boolean isLinkChild(Element element){
  291 + Element parent = element.getParentElement();
  292 + if(parent == null)
  293 + return false;
  294 +
  295 + if(parent.getStartTag().toString().contains("br"))
  296 + parent = parent.getParentElement();
  297 +
  298 + if(element.getParentElement().getStartTag().toString().contains("<a"))
  299 + return true;
  300 + else
  301 + return isLinkChild(element.getParentElement());
  302 +
  303 + }
  304 +
  305 + private Occurrence buildOccurrence(String code, boolean error,
  306 + String tag, Element element) {
  307 + return super.buildOccurrence(code, error, tag, element, OccurrenceClassification.MARK);
  308 + }
  309 +
  310 + public OccurrenceClassification type () { return OccurrenceClassification.MARK;}
  311 +}
... ...
src/main/java/br/com/checker/emag/core/MultimediaEvaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/MultimediaEvaluation.java
... ... @@ -0,0 +1,135 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import net.htmlparser.jericho.Attribute;
  7 +import net.htmlparser.jericho.Element;
  8 +import net.htmlparser.jericho.Source;
  9 +import br.com.checker.emag.Occurrence;
  10 +import br.com.checker.emag.OccurrenceClassification;
  11 +import br.com.checker.emag.core.SpecificRecommendation.MultimediaRecommendation;
  12 +
  13 +public class MultimediaEvaluation extends Evaluation{
  14 +
  15 + private MultimediaEvaluation(Source document) { super(document); }
  16 +
  17 + public static class MultimediaEvaluationBuilder extends EvaluationBuilder {
  18 +
  19 + @Override
  20 + protected MultimediaEvaluation with(Source document) { return new MultimediaEvaluation(document); }
  21 +
  22 + public SpecificRecommendation recommendation33() { return new EvaluationRecommendation33();}
  23 + public SpecificRecommendation recommendation34() { return new EvaluationRecommendation34();}
  24 + public SpecificRecommendation recommendation35() { return new EvaluationRecommendation35();}
  25 + public SpecificRecommendation recommendation36() { return new EvaluationRecommendation36();}
  26 + public SpecificRecommendation recommendation37() { return new EvaluationRecommendation37();}
  27 +
  28 + }
  29 +
  30 + protected static class EvaluationRecommendation33 extends MultimediaRecommendation{
  31 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation33();}
  32 + }
  33 +
  34 + protected static class EvaluationRecommendation34 extends MultimediaRecommendation{
  35 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation34();}
  36 + }
  37 +
  38 + protected static class EvaluationRecommendation35 extends MultimediaRecommendation{
  39 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation35();}
  40 + }
  41 +
  42 + protected static class EvaluationRecommendation36 extends MultimediaRecommendation{
  43 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation36();}
  44 + }
  45 +
  46 + protected static class EvaluationRecommendation37 extends MultimediaRecommendation{
  47 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation37();}
  48 + }
  49 +
  50 +
  51 + public List<Occurrence> check() {
  52 + getOccurrences().clear();
  53 + getOccurrences().addAll(checkRecommendation33());
  54 + getOccurrences().addAll(checkRecommendation34());
  55 + getOccurrences().addAll(checkRecommendation35());
  56 + getOccurrences().addAll(checkRecommendation36());
  57 + getOccurrences().addAll(checkRecommendation37());
  58 +
  59 + return getOccurrences();
  60 + }
  61 +
  62 +
  63 +
  64 + private List<Occurrence> checkRecommendation33() {
  65 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  66 +
  67 + for (Element video : getDocument().getAllElements("embed"))
  68 + occurrences.add(this.buildOccurrence("33", false, video.toString(), video));
  69 +
  70 + for (Element video : this.getDocument().getAllElements("object")) {
  71 +
  72 + Attribute value = video.getAttributes().get("value");
  73 + if (value != null)
  74 + if (value.getValue().contains("mp4")
  75 + || value.getValue().contains("avi")
  76 + || value.getValue().contains("flv")
  77 + || value.getValue().contains("rmvb")) {
  78 + occurrences.add(this.buildOccurrence("33", false,
  79 + video.toString(), video));
  80 + }
  81 + }
  82 +
  83 + return occurrences;
  84 + }
  85 +
  86 + private List<Occurrence> checkRecommendation34() {
  87 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  88 +
  89 + for (Element video : getDocument().getAllElements("object")) {
  90 + Attribute data = video.getAttributes().get("data");
  91 +
  92 + if(data != null && (data.getValue().contains("mp3") || data.getValue().contains("wma") || data.getValue().contains("wav")))
  93 + occurrences.add(this.buildOccurrence("34", false, video.toString(), video));
  94 + }
  95 +
  96 + return occurrences;
  97 + }
  98 +
  99 + private List<Occurrence> checkRecommendation35() {
  100 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  101 +
  102 + for (Element video : getDocument().getAllElements("object"))
  103 + occurrences.add(this.buildOccurrence("35", false, video.toString(), video));
  104 +
  105 + for (Element video : getDocument().getAllElements("embed"))
  106 + occurrences.add(this.buildOccurrence("35", false, video.toString(), video));
  107 +
  108 + return occurrences;
  109 + }
  110 +
  111 + private List<Occurrence> checkRecommendation36() {
  112 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  113 + occurrences.add(new Occurrence("36", false, getDocument().getFirstElement().toString(),OccurrenceClassification.MULTIMEDIA));
  114 + return occurrences;
  115 + }
  116 +
  117 + private List<Occurrence> checkRecommendation37() {
  118 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  119 + for (Element video : getDocument().getAllElements("object")) {
  120 +
  121 + if (video.toString().contains("swf"))
  122 + occurrences.add(this.buildOccurrence("37", false, video.toString(), video));
  123 + }
  124 + return occurrences;
  125 + }
  126 +
  127 +
  128 +
  129 + private Occurrence buildOccurrence(String code, boolean error,
  130 + String tag, Element element) {
  131 + return super.buildOccurrence(code, error, tag, element, OccurrenceClassification.MULTIMEDIA);
  132 + }
  133 +
  134 + public OccurrenceClassification type () { return OccurrenceClassification.MULTIMEDIA;}
  135 +}
... ...
src/main/java/br/com/checker/emag/core/PresentationEvaluation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/PresentationEvaluation.java
... ... @@ -0,0 +1,166 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +import net.htmlparser.jericho.Attribute;
  7 +import net.htmlparser.jericho.Element;
  8 +import net.htmlparser.jericho.Source;
  9 +import br.com.checker.emag.Occurrence;
  10 +import br.com.checker.emag.OccurrenceClassification;
  11 +import br.com.checker.emag.core.SpecificRecommendation.PresentationRecommendation;
  12 +
  13 +public class PresentationEvaluation extends Evaluation{
  14 +
  15 + private PresentationEvaluation(Source document) { super(document); }
  16 +
  17 + public static class PresentationEvaluationBuilder extends EvaluationBuilder {
  18 +
  19 + @Override
  20 + protected PresentationEvaluation with(Source document) { return new PresentationEvaluation(document); }
  21 +
  22 + public SpecificRecommendation recommendation28() { return new EvaluationRecommendation28();}
  23 + public SpecificRecommendation recommendation29() { return new EvaluationRecommendation29();}
  24 + public SpecificRecommendation recommendation30() { return new EvaluationRecommendation30();}
  25 + public SpecificRecommendation recommendation31() { return new EvaluationRecommendation31();}
  26 + public SpecificRecommendation recommendation32() { return new EvaluationRecommendation32();}
  27 + }
  28 +
  29 + protected static class EvaluationRecommendation28 extends PresentationRecommendation{
  30 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation28();}
  31 + }
  32 + protected static class EvaluationRecommendation29 extends PresentationRecommendation{
  33 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation29();}
  34 + }
  35 +
  36 + protected static class EvaluationRecommendation30 extends PresentationRecommendation{
  37 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation30();}
  38 + }
  39 + protected static class EvaluationRecommendation31 extends PresentationRecommendation{
  40 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation31();}
  41 + }
  42 + protected static class EvaluationRecommendation32 extends PresentationRecommendation{
  43 + protected List<Occurrence> check() { return getEvaluation().checkRecommendation32();}
  44 + }
  45 +
  46 + public List<Occurrence> check() {
  47 + getOccurrences().clear();
  48 + getOccurrences().addAll(checkRecommendation28());
  49 + getOccurrences().addAll(checkRecommendation29());
  50 + getOccurrences().addAll(checkRecommendation30());
  51 + getOccurrences().addAll(checkRecommendation31());
  52 + getOccurrences().addAll(checkRecommendation32());
  53 +
  54 + return getOccurrences();
  55 + }
  56 +
  57 +
  58 +
  59 + private List<Occurrence> checkRecommendation28() {
  60 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  61 +
  62 + boolean temBgcolor = false;
  63 + for (Element bgcolor : getDocument().getAllElements("body")) {
  64 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  65 + if(bgc != null){
  66 + occurrences.add(buildOccurrence("28", true, bgcolor.toString(), bgcolor));
  67 + temBgcolor = true;
  68 + }
  69 + }
  70 + for (Element bgcolor : getDocument().getAllElements("table")) {
  71 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  72 + if(bgc != null){
  73 + occurrences.add(buildOccurrence("28", true, bgcolor.toString(), bgcolor));
  74 + temBgcolor = true;
  75 + }
  76 + }
  77 + for (Element bgcolor : getDocument().getAllElements("td")) {
  78 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  79 + if(bgc != null){
  80 + occurrences.add(buildOccurrence("28", true, bgcolor.toString(), bgcolor));
  81 + temBgcolor = true;
  82 + }
  83 + }
  84 + for (Element bgcolor : getDocument().getAllElements("tr")) {
  85 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  86 + if(bgc != null){
  87 + occurrences.add(buildOccurrence("28", true, bgcolor.toString(), bgcolor));
  88 + temBgcolor = true;
  89 + }
  90 + }
  91 +
  92 + if(!temBgcolor)
  93 + occurrences.add(new Occurrence("28", false, getDocument().getFirstElement().toString(),OccurrenceClassification.PRESENTATION_DESIGN));
  94 +
  95 + return occurrences;
  96 + }
  97 +
  98 + private List<Occurrence> checkRecommendation29() {
  99 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  100 +
  101 + boolean temBgcolor = false;
  102 + for (Element bgcolor : getDocument().getAllElements("body")) {
  103 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  104 + if(bgc != null){
  105 + occurrences.add(buildOccurrence("29", true, bgcolor.toString(), bgcolor));
  106 + temBgcolor = true;
  107 + }
  108 + }
  109 + for (Element bgcolor : getDocument().getAllElements("table")) {
  110 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  111 + if(bgc != null){
  112 + occurrences.add(buildOccurrence("29", true, bgcolor.toString(), bgcolor));
  113 + temBgcolor = true;
  114 + }
  115 + }
  116 + for (Element bgcolor : getDocument().getAllElements("td")) {
  117 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  118 + if(bgc != null){
  119 + occurrences.add(buildOccurrence("29", true, bgcolor.toString(), bgcolor));
  120 + temBgcolor = true;
  121 + }
  122 + }
  123 + for (Element bgcolor : getDocument().getAllElements("tr")) {
  124 + Attribute bgc = bgcolor.getAttributes().get("bgcolor");
  125 + if(bgc != null){
  126 + occurrences.add(buildOccurrence("29", true, bgcolor.toString(), bgcolor));
  127 + temBgcolor = true;
  128 + }
  129 + }
  130 +
  131 + if(!temBgcolor)
  132 + occurrences.add(new Occurrence("29", false, getDocument().getFirstElement().toString(),OccurrenceClassification.PRESENTATION_DESIGN));
  133 +
  134 + return occurrences;
  135 + }
  136 +
  137 + private List<Occurrence> checkRecommendation30() {
  138 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  139 + occurrences.add(new Occurrence("30", false, getDocument().getFirstElement().toString(),OccurrenceClassification.PRESENTATION_DESIGN));
  140 + return occurrences;
  141 + }
  142 +
  143 + private List<Occurrence> checkRecommendation31() {
  144 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  145 + occurrences.add(new Occurrence("31", false, getDocument().getFirstElement().toString(),OccurrenceClassification.PRESENTATION_DESIGN));
  146 +
  147 + return occurrences;
  148 + }
  149 +
  150 + private List<Occurrence> checkRecommendation32() {
  151 + List<Occurrence> occurrences = new ArrayList<Occurrence>();
  152 + occurrences.add(new Occurrence("32", false, getDocument().getFirstElement().toString(),OccurrenceClassification.PRESENTATION_DESIGN));
  153 +
  154 + return occurrences;
  155 + }
  156 +
  157 +
  158 +
  159 +
  160 + private Occurrence buildOccurrence(String code, boolean error,
  161 + String tag, Element element) {
  162 + return super.buildOccurrence(code, error, tag, element, OccurrenceClassification.PRESENTATION_DESIGN);
  163 + }
  164 +
  165 + public OccurrenceClassification type () { return OccurrenceClassification.PRESENTATION_DESIGN;}
  166 +}
... ...
src/main/java/br/com/checker/emag/core/SpecificRecommendation.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/core/SpecificRecommendation.java
... ... @@ -0,0 +1,53 @@
  1 +package br.com.checker.emag.core;
  2 +
  3 +import java.util.List;
  4 +
  5 +import net.htmlparser.jericho.Source;
  6 +import br.com.checker.emag.Occurrence;
  7 +import br.com.checker.emag.OccurrenceClassification;
  8 +
  9 +public abstract class SpecificRecommendation {
  10 +
  11 + protected Source document ;
  12 +
  13 + protected void with(Source document) {this.document = document;}
  14 +
  15 + protected abstract List<Occurrence> check();
  16 + protected abstract OccurrenceClassification type();
  17 +
  18 + protected static abstract class MarkRecommendation extends SpecificRecommendation {
  19 +
  20 + protected MarkEvaluation getEvaluation() { return new MarkEvaluation.MarkEvaluationBuilder().with(document);}
  21 + protected OccurrenceClassification type () { return OccurrenceClassification.MARK;}
  22 + }
  23 +
  24 + protected static abstract class FormRecommendation extends SpecificRecommendation {
  25 +
  26 + protected FormEvaluation getEvaluation() { return new FormEvaluation.FormEvaluationBuilder().with(document);}
  27 + protected OccurrenceClassification type () { return OccurrenceClassification.FORM; }
  28 + }
  29 +
  30 + protected static abstract class BehaviorRecommendation extends SpecificRecommendation {
  31 +
  32 + protected BehaviorEvaluation getEvaluation() { return new BehaviorEvaluation.BehaviorEvaluationBuilder().with(document);}
  33 + protected OccurrenceClassification type () { return OccurrenceClassification.BEHAVIOR; }
  34 + }
  35 +
  36 + protected static abstract class MultimediaRecommendation extends SpecificRecommendation {
  37 +
  38 + protected MultimediaEvaluation getEvaluation() { return new MultimediaEvaluation.MultimediaEvaluationBuilder().with(document);}
  39 + protected OccurrenceClassification type () { return OccurrenceClassification.MULTIMEDIA; }
  40 + }
  41 +
  42 + protected static abstract class ContentRecommendation extends SpecificRecommendation {
  43 +
  44 + protected ContentEvaluation getEvaluation() { return new ContentEvaluation.ContentEvaluationBuilder().with(document);}
  45 + protected OccurrenceClassification type () { return OccurrenceClassification.CONTENT_INFORMATION; }
  46 + }
  47 +
  48 + protected static abstract class PresentationRecommendation extends SpecificRecommendation {
  49 +
  50 + protected PresentationEvaluation getEvaluation() { return new PresentationEvaluation.PresentationEvaluationBuilder().with(document);}
  51 + protected OccurrenceClassification type () { return OccurrenceClassification.PRESENTATION_DESIGN; }
  52 + }
  53 +}
... ...
src/main/java/br/com/checker/emag/xml/AvaliationReport.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/xml/AvaliationReport.java
... ... @@ -0,0 +1,11 @@
  1 +package br.com.checker.emag.xml;
  2 +
  3 +import lombok.Data;
  4 +
  5 +public @Data class AvaliationReport {
  6 +
  7 + private Result result;
  8 +
  9 +
  10 + public AvaliationReport() { this.result = new Result(); }
  11 +}
... ...
src/main/java/br/com/checker/emag/xml/CheckPoint.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/xml/CheckPoint.java
... ... @@ -0,0 +1,10 @@
  1 +package br.com.checker.emag.xml;
  2 +
  3 +import lombok.Data;
  4 +
  5 +public @Data class CheckPoint {
  6 +
  7 + private String description;
  8 + private int totalErrors;
  9 + private int totalWarnings;
  10 +}
... ...
src/main/java/br/com/checker/emag/xml/Result.java 0 → 100644
  1 +++ a/src/main/java/br/com/checker/emag/xml/Result.java
... ... @@ -0,0 +1,22 @@
  1 +package br.com.checker.emag.xml;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +import lombok.Data;
  8 +import lombok.Getter;
  9 +
  10 +public @Data class Result{
  11 +
  12 + private String url;
  13 + private Date date;
  14 + private String html;
  15 +
  16 + @Getter private List<CheckPoint> checkPoints;
  17 +
  18 + public Result(){ this.checkPoints = new ArrayList<CheckPoint>(); }
  19 +
  20 + public void addCheckPoint(CheckPoint checkPoint) { this.checkPoints.add(checkPoint) ; }
  21 +
  22 +}
... ...
src/test/java/br/com/checker/emag/BehaviorEvaluationTest.java 0 → 100644
  1 +++ a/src/test/java/br/com/checker/emag/BehaviorEvaluationTest.java
... ... @@ -0,0 +1,168 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import static br.com.checker.emag.core.Checker.from;
  4 +import static br.com.checker.emag.core.Checker.behavior;
  5 +import static org.junit.Assert.*;
  6 +
  7 +
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.junit.Test;
  12 +import org.junit.runner.RunWith;
  13 +import org.junit.runners.JUnit4;
  14 +
  15 +import br.com.checker.emag.Occurrence;
  16 +import br.com.checker.emag.OccurrenceClassification;
  17 +
  18 +@RunWith(JUnit4.class)
  19 +public class BehaviorEvaluationTest {
  20 +
  21 +
  22 + @Test
  23 + public void shouldCheckRecommedation10() {
  24 + StringBuilder html = new StringBuilder("<html>");
  25 + html.append("<script>alert(\"teste\");</script>");
  26 + html.append("<object></object>");
  27 + html.append("</html>");
  28 +
  29 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  30 + .with(behavior().recommendation10()).check();
  31 +
  32 + assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  33 + assertEquals("Should return Recommendation 10","10",occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).getCode());
  34 + assertTrue("Recommendation 10 should be ERROR",occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  35 + assertTrue("Recommendation 10 should be ERROR",occurrences.get(OccurrenceClassification.BEHAVIOR).get(1).isError());
  36 + }
  37 +
  38 + @Test
  39 + public void shouldNotCheckRecommedation10() {
  40 + StringBuilder html = new StringBuilder("<<html>")
  41 + .append("<script></script><noscript></noscript>")
  42 + .append("</html>");
  43 +
  44 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  45 + .with(behavior().recommendation10()).check();
  46 +
  47 + assertEquals("Shoud not return occurrences", 0,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  48 + }
  49 +
  50 + @Test
  51 + public void shouldCheckRecommedation11WithError() {
  52 + StringBuilder html = new StringBuilder("<<html>")
  53 + .append("<head>")
  54 + .append("<meta http-equiv=\"refresh\" content=\"20; url='http://www.exemplo.com/'\" />")
  55 + .append("</head>")
  56 + .append("</html>");
  57 +
  58 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  59 + .with(behavior().recommendation11()).check();
  60 +
  61 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  62 + assertTrue("Recommendation 11 should be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  63 +
  64 + }
  65 +
  66 + @Test
  67 + public void shouldCheckRecommedation11WithWarning() {
  68 + StringBuilder html = new StringBuilder("<<html>")
  69 + .append("<head>")
  70 + .append("<title>teste</title>")
  71 + .append("</head>")
  72 + .append("</html>");
  73 +
  74 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  75 + .with(behavior().recommendation11()).check();
  76 +
  77 + assertFalse("Recommendation 11 should not be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  78 + }
  79 +
  80 +
  81 + @Test
  82 + public void shouldCheckRecommedation12WithError() {
  83 + StringBuilder html = new StringBuilder("<<html>")
  84 + .append("<head>")
  85 + .append("<meta http-equiv=\"refresh\" content=\"20; url='http://www.exemplo.com/'\" />")
  86 + .append("</head>")
  87 + .append("</html>");
  88 +
  89 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  90 + .with(behavior().recommendation12()).check();
  91 +
  92 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  93 + assertTrue("Recommendation 12 should be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  94 +
  95 + }
  96 +
  97 + @Test
  98 + public void shouldCheckRecommedation12WithWarning() {
  99 + StringBuilder html = new StringBuilder("<<html>")
  100 + .append("<head>")
  101 + .append("<title>teste</title>")
  102 + .append("</head>")
  103 + .append("</html>");
  104 +
  105 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  106 + .with(behavior().recommendation12()).check();
  107 +
  108 + assertFalse("Recommendation 12 should not be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  109 + }
  110 +
  111 + @Test
  112 + public void shouldCheckRecommedation13() {
  113 + StringBuilder html = new StringBuilder("<<html>")
  114 + .append("<head>")
  115 + .append("<title>teste</title>")
  116 + .append("</head>")
  117 + .append("</html>");
  118 +
  119 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  120 + .with(behavior().recommendation13()).check();
  121 + assertEquals("Should return 1 occurrence", 1,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  122 + assertFalse("Recommendation 13 should not be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  123 + }
  124 +
  125 + @Test
  126 + public void shouldCheckRecommedation14WithError() {
  127 + StringBuilder html = new StringBuilder("<<html>")
  128 + .append("<blink></blink>")
  129 + .append("<marquee></marquee>")
  130 + .append("</html>");
  131 +
  132 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  133 + .with(behavior().recommendation14()).check();
  134 +
  135 + assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  136 + assertTrue("Recommendation 14 should be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  137 + }
  138 +
  139 + @Test
  140 + public void shouldCheckRecommedation14WithWarning() {
  141 + StringBuilder html = new StringBuilder("<<html>")
  142 + .append("</html>");
  143 +
  144 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  145 + .with(behavior().recommendation14()).check();
  146 +
  147 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  148 + assertFalse("Recommendation 14 should be WARNING", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  149 + }
  150 +
  151 +
  152 + @Test
  153 + public void shouldCheckRecommedation15() {
  154 + StringBuilder html = new StringBuilder("<<html>")
  155 + .append("<head>")
  156 + .append("<title>teste</title>")
  157 + .append("</head>")
  158 + .append("</html>");
  159 +
  160 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  161 + .with(behavior().recommendation15()).check();
  162 + assertEquals("Should return 1 occurrence", 1,occurrences.get(OccurrenceClassification.BEHAVIOR).size());
  163 + assertFalse("Recommendation 15 should not be ERROR", occurrences.get(OccurrenceClassification.BEHAVIOR).get(0).isError());
  164 + }
  165 +
  166 +
  167 +
  168 +}
... ...
src/test/java/br/com/checker/emag/ContentEvaluationTest.java 0 → 100644
  1 +++ a/src/test/java/br/com/checker/emag/ContentEvaluationTest.java
... ... @@ -0,0 +1,230 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import static br.com.checker.emag.core.Checker.from;
  4 +import static br.com.checker.emag.core.Checker.content;
  5 +import static br.com.checker.emag.core.Checker.marking;
  6 +import static org.junit.Assert.*;
  7 +
  8 +
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +import org.junit.Test;
  13 +import org.junit.runner.RunWith;
  14 +import org.junit.runners.JUnit4;
  15 +
  16 +import br.com.checker.emag.Occurrence;
  17 +import br.com.checker.emag.OccurrenceClassification;
  18 +
  19 +@RunWith(JUnit4.class)
  20 +public class ContentEvaluationTest {
  21 +
  22 +
  23 + @Test
  24 + public void shouldCheckRecommedation16() {
  25 +
  26 + StringBuilder html = new StringBuilder("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\"> ");
  27 + html.append("</html>");
  28 +
  29 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  30 + .with(content().recommendation16()).check();
  31 +
  32 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  33 + assertEquals("Should return Recommendation 16 occurrence","16",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  34 + assertTrue("Recommendation 16 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  35 + }
  36 +
  37 +
  38 + @Test
  39 + public void shouldNotCheckRecommedation16() {
  40 + StringBuilder html = new StringBuilder("<html lang='en'></html>");
  41 +
  42 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  43 + .with(content().recommendation16()).check();
  44 +
  45 + assertEquals("Should not return occurrences", 0,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  46 + }
  47 +
  48 + @Test
  49 + public void shouldCheckNotRecommedation16OnXhtml() {
  50 + StringBuilder html = new StringBuilder("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\"> ");
  51 + html.append("</html>");
  52 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  53 + .with(content().recommendation16()).check();
  54 + assertEquals("Should not return occurrences", 0,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  55 + }
  56 +
  57 + @Test
  58 + public void shouldCheckRecommedation17() {
  59 +
  60 + StringBuilder html = new StringBuilder("<html> ");
  61 + html.append("</html>");
  62 +
  63 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  64 + .with(content().recommendation17()).check();
  65 +
  66 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  67 + assertEquals("Should return Recommendation 17","17",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  68 + assertTrue("Recommendation 17 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  69 + }
  70 +
  71 + @Test
  72 + public void shouldAlwaysCheckRecommendation18() {
  73 + StringBuilder html = new StringBuilder("<html></html>");
  74 +
  75 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  76 + .with(content().recommendation18()).check();
  77 +
  78 + assertEquals("Should return Recommendation 18 ","18",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  79 + assertFalse("Recommendation 18 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  80 +
  81 + }
  82 +
  83 + @Test
  84 + public void shouldCheckRecommedation19() {
  85 +
  86 + StringBuilder html = new StringBuilder("<html> ");
  87 + html.append("<a></a>");
  88 + html.append("<a name=\"test\" ></a>");
  89 + html.append("<a href=\"#testDif\" ></a>");
  90 + html.append("</html>");
  91 +
  92 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  93 + .with(content().recommendation19()).check();
  94 +
  95 + assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  96 + assertEquals("Should return Recommendation 19","19",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  97 + assertEquals("Should return Recommendation 19","19",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(1).getCode());
  98 + assertTrue("Recommendation 19 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  99 + assertTrue("Recommendation 19 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(1).isError());
  100 + }
  101 +
  102 + @Test
  103 + public void shouldReturn1Recommedation19() {
  104 +
  105 + StringBuilder html = new StringBuilder("<html> ");
  106 + html.append("<a></a>");
  107 + html.append("<a name=\"test\" ></a>");
  108 + html.append("<a href=\"#test\" ></a>");
  109 + html.append("</html>");
  110 +
  111 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  112 + .with(content().recommendation19()).check();
  113 +
  114 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  115 + assertEquals("Should return Recommendation 19","19",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  116 + assertTrue("Recommendation 19 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  117 +
  118 + }
  119 +
  120 +
  121 + @Test
  122 + public void shouldCheckRecommedation20() {
  123 +
  124 + StringBuilder html = new StringBuilder("<html> ");
  125 + html.append("<img alt=\"\"></img>");
  126 + html.append("</html>");
  127 +
  128 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  129 + .with(content().recommendation20()).check();
  130 +
  131 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  132 + assertEquals("Should return Recommendation 20","20",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  133 + assertTrue("Recommendation 20 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  134 + }
  135 +
  136 +
  137 + @Test
  138 + public void shouldCheckRecommedation21() {
  139 +
  140 + StringBuilder html = new StringBuilder("<html> ");
  141 + html.append("<area alt=\"\"></area>");
  142 + html.append("<img ismap=\"ismap\"></img>");
  143 + html.append("</html>");
  144 +
  145 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  146 + .with(content().recommendation21()).check();
  147 +
  148 + assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  149 + assertEquals("Should return Recommendation 21","21",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  150 + assertEquals("Should return Recommendation 21","21",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(1).getCode());
  151 + assertTrue("Recommendation 21 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  152 + assertFalse("Recommendation 21 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(1).isError());
  153 + }
  154 +
  155 + @Test
  156 + public void shouldCheckRecommedation22() {
  157 +
  158 + StringBuilder html = new StringBuilder("<html> ");
  159 + html.append("<a href=\"doc.pdf\"></a>");
  160 + html.append("</html>");
  161 +
  162 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  163 + .with(content().recommendation22()).check();
  164 +
  165 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  166 + assertEquals("Should return Recommendation 22","22",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  167 + assertFalse("Recommendation 22 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  168 + }
  169 +
  170 + @Test
  171 + public void shouldCheckRecommedation23() {
  172 +
  173 + StringBuilder html = new StringBuilder("<html> ");
  174 + html.append("<table>");
  175 + html.append("</table>");
  176 + html.append("</html>");
  177 +
  178 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  179 + .with(content().recommendation23()).check();
  180 +
  181 + assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  182 + assertEquals("Should return Recommendation 22","23",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  183 + assertEquals("Should return Recommendation 22","23",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(1).getCode());
  184 + assertTrue("Recommendation 23 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  185 + assertTrue("Recommendation 23 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(1).isError());
  186 + }
  187 +
  188 +
  189 + @Test
  190 + public void shouldAlwaysCheckRecommendation25() {
  191 + StringBuilder html = new StringBuilder("<html></html>");
  192 +
  193 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  194 + .with(content().recommendation25()).check();
  195 +
  196 + assertEquals("Should return Recommendation 25 ","25",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  197 + assertFalse("Recommendation 25 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  198 +
  199 + }
  200 +
  201 + @Test
  202 + public void shouldCheckRecommedation26() {
  203 +
  204 + StringBuilder html = new StringBuilder("<html> ");
  205 + html.append("<abbr title=\"\"></abbr>");
  206 + html.append("</html>");
  207 +
  208 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  209 + .with(content().recommendation26()).check();
  210 +
  211 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size());
  212 + assertEquals("Should return Recommendation 26","26",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  213 + assertTrue("Recommendation 26 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  214 + }
  215 +
  216 +
  217 +
  218 + @Test
  219 + public void shouldAlwaysCheckRecommendation27() {
  220 + StringBuilder html = new StringBuilder("<html></html>");
  221 +
  222 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  223 + .with(content().recommendation27()).check();
  224 +
  225 + assertEquals("Should return Recommendation 27 ","27",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode());
  226 + assertFalse("Recommendation 27 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError());
  227 +
  228 + }
  229 +
  230 +}
... ...
src/test/java/br/com/checker/emag/FormEvaluationTest.java 0 → 100644
  1 +++ a/src/test/java/br/com/checker/emag/FormEvaluationTest.java
... ... @@ -0,0 +1,137 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import static br.com.checker.emag.core.Checker.from;
  4 +import static br.com.checker.emag.core.Checker.form;
  5 +import static org.junit.Assert.*;
  6 +
  7 +
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.junit.Test;
  12 +import org.junit.runner.RunWith;
  13 +import org.junit.runners.JUnit4;
  14 +
  15 +@RunWith(JUnit4.class)
  16 +public class FormEvaluationTest {
  17 +
  18 +
  19 + @Test
  20 + public void shouldCheckRecommedation38() {
  21 + StringBuilder html = new StringBuilder("<html>");
  22 + html.append("<form>");
  23 + html.append("<input type=\"image\" src=\"img_submit.gif\" alt=\"Submit\"></input>");
  24 + html.append("<input type=\"image\" src=\"img_submit.gif\"></input> ");
  25 + html.append("<input type=\"submit\" value=\"\"></input>");
  26 + html.append("<input type=\"reset\" value=\"\"></input>");
  27 + html.append("<input type=\"button\" value=\"\"></input>");
  28 + html.append("</form>");
  29 + html.append("</html>");
  30 +
  31 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  32 + .with(form().recommendation38()).check();
  33 +
  34 + assertEquals("Should return 4 occurrences", 4,occurrences.get(OccurrenceClassification.FORM).size());
  35 +
  36 + for(Occurrence occurrence :occurrences.get(OccurrenceClassification.FORM) ) {
  37 + assertEquals("Should return Recommendation 38","38",occurrence.getCode());
  38 + assertTrue("Recommendation 38 should be ERROR",occurrence.isError());
  39 + }
  40 + }
  41 +
  42 +
  43 + @Test
  44 + public void shouldCheckRecommedation40() {
  45 + StringBuilder html = new StringBuilder("<html>");
  46 + html.append("<form>");
  47 + html.append("<input type=\"text\" tabindex=\"1\" alt=\"Submit\"></input>");
  48 + html.append("<input type=\"text\" src=\"img_submit.gif\"></input> ");
  49 + html.append("<input type=\"submit\" value=\"\" tabindex=\"2\"></input>");
  50 + html.append("</form>");
  51 + html.append("</html>");
  52 +
  53 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  54 + .with(form().recommendation40()).check();
  55 +
  56 + assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.FORM).size());
  57 +
  58 + for(Occurrence occurrence :occurrences.get(OccurrenceClassification.FORM) ) {
  59 + assertEquals("Should return Recommendation 40","40",occurrence.getCode());
  60 + assertFalse("Recommendation 40 should be WARNING",occurrence.isError());
  61 + }
  62 + }
  63 +
  64 + @Test
  65 + public void shouldCheckRecommendation43() {
  66 + StringBuilder html = new StringBuilder("<html><form></form></html>");
  67 +
  68 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  69 + .with(form().recommendation43()).check();
  70 +
  71 + assertEquals("Should return 1 occurrence", 1,occurrences.get(OccurrenceClassification.FORM).size());
  72 + assertEquals("Should return Recommendation 43 ","43",occurrences.get(OccurrenceClassification.FORM).get(0).getCode());
  73 + assertFalse("Recommendation 45 should be WARNING",occurrences.get(OccurrenceClassification.FORM).get(0).isError());
  74 +
  75 + }
  76 +
  77 + @Test
  78 + public void shouldCheckRecommedation44() {
  79 + StringBuilder html = new StringBuilder("<html>");
  80 + html.append("<form></form>");
  81 + html.append("<form>");
  82 + html.append("<fieldset></fieldset>");
  83 + html.append("<fieldset><legend>Desc</legend></fieldset>");
  84 + html.append("<select></select>");
  85 + html.append("<select>");
  86 + html.append("<optgroup label=\"Swedish Cars\">");
  87 + html.append("<option value=\"volvo\">Volvo</option>");
  88 + html.append("<option value=\"saab\">Saab</option>");
  89 + html.append("</optgroup>");
  90 + html.append("<optgroup>");
  91 + html.append("<option value=\"mercedes\">Mercedes</option>");
  92 + html.append("<option value=\"audi\">Audi</option>");
  93 + html.append("</optgroup>");
  94 + html.append("</select>");
  95 + html.append("<input type=\"submit\" value=\"\" tabindex=\"2\"></input>");
  96 + html.append("</form>");
  97 + html.append("</html>");
  98 +
  99 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  100 + .with(form().recommendation44()).check();
  101 +
  102 + assertEquals("Should return 4 occurrences", 4,occurrences.get(OccurrenceClassification.FORM).size());
  103 + assertFalse("Recommendation 45 should be WARNING",occurrences.get(OccurrenceClassification.FORM).get(0).isError());
  104 + assertTrue("Recommendation 45 should be ERROR",occurrences.get(OccurrenceClassification.FORM).get(1).isError());
  105 + assertFalse("Recommendation 45 should be WARNING",occurrences.get(OccurrenceClassification.FORM).get(2).isError());
  106 + assertTrue("Recommendation 45 should be ERROR",occurrences.get(OccurrenceClassification.FORM).get(3).isError());
  107 +
  108 +
  109 + }
  110 +
  111 +
  112 +
  113 + @Test
  114 + public void shouldCheckRecommendation45() {
  115 + StringBuilder html = new StringBuilder("<html><form></form></html>");
  116 +
  117 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  118 + .with(form().recommendation45()).check();
  119 +
  120 + assertEquals("Should return 1 occurrence", 1,occurrences.get(OccurrenceClassification.FORM).size());
  121 + assertEquals("Should return Recommendation 45 ","45",occurrences.get(OccurrenceClassification.FORM).get(0).getCode());
  122 + assertFalse("Recommendation 45 should be WARNING",occurrences.get(OccurrenceClassification.FORM).get(0).isError());
  123 +
  124 + }
  125 +
  126 +
  127 + @Test
  128 + public void shouldNotCheckRecommendation45() {
  129 + StringBuilder html = new StringBuilder("<html></html>");
  130 +
  131 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  132 + .with(form().recommendation45()).check();
  133 +
  134 + assertEquals("Should return 0 occurrence", 0,occurrences.get(OccurrenceClassification.FORM).size());
  135 + }
  136 +
  137 +}
... ...
src/test/java/br/com/checker/emag/MarkEvaluationTest.java 0 → 100644
  1 +++ a/src/test/java/br/com/checker/emag/MarkEvaluationTest.java
... ... @@ -0,0 +1,253 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import static br.com.checker.emag.core.Checker.from;
  4 +import static br.com.checker.emag.core.Checker.marking;
  5 +import static org.junit.Assert.*;
  6 +
  7 +
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.junit.Test;
  12 +import org.junit.runner.RunWith;
  13 +import org.junit.runners.JUnit4;
  14 +
  15 +import br.com.checker.emag.Occurrence;
  16 +import br.com.checker.emag.OccurrenceClassification;
  17 +
  18 +@RunWith(JUnit4.class)
  19 +public class MarkEvaluationTest {
  20 +
  21 +
  22 + @Test
  23 + public void shouldCheckRecommedation1() {
  24 + StringBuilder html = new StringBuilder("<html></html>");
  25 +
  26 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  27 + .with(marking().recommendation1()).check();
  28 +
  29 + assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.MARK).size());
  30 + assertEquals("Should return Recommendation 1 occurrence","1",occurrences.get(OccurrenceClassification.MARK).get(0).getCode());
  31 + assertTrue("Recommendation 1 should be ERROR",occurrences.get(OccurrenceClassification.MARK).get(0).isError());
  32 +
  33 + }
  34 +
  35 + @Test
  36 + public void shouldNotCheckRecommedation1() {
  37 + StringBuilder html = new StringBuilder("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
  38 + .append("<html></html>");
  39 +
  40 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  41 + .with(marking().recommendation1()).check();
  42 +
  43 + assertEquals("Shoud not return occurrences", 0,occurrences.get(OccurrenceClassification.MARK).size());
  44 + }
  45 +
  46 + @Test
  47 + public void shouldAlwaysCheckRecommendation2() {
  48 + StringBuilder html = new StringBuilder("<html></html>");
  49 +
  50 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  51 + .with(marking().recommendation2()).check();
  52 +
  53 + assertEquals("Should return Recommendation 2 occurrence","2",occurrences.get(OccurrenceClassification.MARK).get(0).getCode());
  54 + assertFalse("Recommendation 2 should be WARNING",occurrences.get(OccurrenceClassification.MARK).get(0).isError());
  55 + assertNull("Recoomendation 2 should not return line",occurrences.get(OccurrenceClassification.MARK).get(0).getLine());
  56 +
  57 + }
  58 +
  59 + @Test
  60 + public void shouldCheckRecommedation3() {
  61 + StringBuilder html = new StringBuilder("<html>\n")
  62 + .append("<h1>Title1</h1>\n")
  63 + .append("<h1>Title1.2</h1>\n")
  64 + .append("<h2>Title2</h2>\n")
  65 + .append("<h4>Title3</h4>\n")
  66 + .append("<h6>Title6</h6>\n")
  67 + .append("</html>");
  68 +
  69 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  70 + .with(marking().recommendation3()).check();
  71 +
  72 + for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) {
  73 + assertEquals("Should return Recommendation 3 occurrence","3",ocorrencia.getCode());
  74 + assertTrue("Occurrences lines should be 3 - h1 , 5- h4 or 6 - h6 ",
  75 + ocorrencia.getLine() == 3 || ocorrencia.getLine() == 5 || ocorrencia.getLine() == 6);
  76 + }
  77 + }
  78 +
  79 + @Test
  80 + public void shouldCheckRecommedation4() {
  81 + StringBuilder html = new StringBuilder("<html>\n")
  82 + .append("<a tabindex=\"1\">link1</a><a tabindex=\"5\">link2</a>\n")
  83 + .append("<input type=\"text\"/>\n")
  84 + .append("<input tabindex=\"2\" type=\"text\"/>\n")
  85 + .append("<select tabindex=\"8\">\n")
  86 + .append("<option>option 1</option>\n")
  87 + .append("</select>\n")
  88 + .append("<textarea tabindex=\"6\"/>\n")
  89 + .append("</html>");
  90 +
  91 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  92 + .with(marking().recommendation4()).check();
  93 +
  94 + assertEquals(5, occurrences.get(OccurrenceClassification.MARK).size());
  95 +
  96 + for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) {
  97 + assertEquals("Should return Recommendation 4 occurrence","4",ocorrencia.getCode());
  98 + assertFalse("Recommendation 4 should be WARNING",ocorrencia.isError());
  99 + }
  100 + }
  101 +
  102 + @Test
  103 + public void shouldCheckRecommedation5() {
  104 + StringBuilder html = new StringBuilder("<html>\n")
  105 + .append("<a onclick=\"click()\">link1</a> <a onclick=\"click()\" onkeypress=\"press();\">link2</a>\n")
  106 + .append("<a onmousedown=\"mouseDown()\">link3</a> <a onmousedown=\"mouseDown()\" onkeydown=\"keyDown();\">link4</a>\n")
  107 + .append("<a onmouseup=\"mouseUp()\">link5</a> <a onmouseup=\"mouseUp()\" onkeyup=\"keyUp();\">link6</a>\n")
  108 + .append("<a onmouseover=\"over()\">link7</a> <a onmouseover=\"over()\" onfocus=\"focus();\">link8</a>\n")
  109 + .append("<a onmouseout=\"out()\">link9</a> <a onmouseout=\"out()\" onblur=\"blur();\">link10</a>\n")
  110 + .append("</html>");
  111 +
  112 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  113 + .with(marking().recommendation5()).check();
  114 +
  115 + for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) {
  116 + assertEquals("Should return Recommendation 5 occurrence","5",ocorrencia.getCode());
  117 + assertTrue("Recommendation 1 should be ERROR",ocorrencia.isError());
  118 +
  119 + }
  120 +
  121 + assertEquals(5, occurrences.get(OccurrenceClassification.MARK).size());
  122 + }
  123 +
  124 + @Test
  125 + public void shouldCheckRecommedation6() {
  126 +
  127 + StringBuilder html = new StringBuilder("<html>\n")
  128 + .append("<a href=\"link1.html\">Link</a>\n")
  129 + .append("<a href=\"link2.html\">Link 2</a>\n")
  130 + .append("</html>");
  131 +
  132 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  133 + .with(marking().recommendation6()).check();
  134 +
  135 + assertEquals("Should return 1 occurrence",1, occurrences.get(OccurrenceClassification.MARK).size());
  136 + assertEquals("Should return Recommendation 6 occurrence","6",occurrences.get(OccurrenceClassification.MARK).get(0).getCode());
  137 + assertFalse("Recommendation 1 should be WARNING",occurrences.get(OccurrenceClassification.MARK).get(0).isError());
  138 +
  139 + }
  140 +
  141 + @Test
  142 + public void shouldNotReturnRecommendationOccurrence6() {
  143 +
  144 + StringBuilder html = new StringBuilder("<html>\n")
  145 + .append("<a href=\"#anchor\">Anchor 1</a>\n")
  146 + .append("<a href=\"#anchor2\">Anchor 2</a>\n")
  147 + .append("<a href=\"link1.html\">Link</a>\n")
  148 + .append("</html>");
  149 +
  150 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  151 + .with(marking().recommendation6()).check();
  152 +
  153 + assertEquals("Should not return occurrences",0, occurrences.get(OccurrenceClassification.MARK).size());
  154 + }
  155 +
  156 + @Test
  157 + public void shouldCheckRecommedation7() {
  158 +
  159 + StringBuilder html = new StringBuilder("<html>\n")
  160 + .append("<table></table>\n")
  161 + .append("<table></table>\n")
  162 + .append("</html>");
  163 +
  164 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  165 + .with(marking().recommendation7()).check();
  166 +
  167 + assertEquals("Deve retornar 2 ocorrencia",2, occurrences.get(OccurrenceClassification.MARK).size());
  168 +
  169 + for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) {
  170 + assertEquals("Should return Recommendation 7 occurrence","7",ocorrencia.getCode());
  171 + assertFalse("Recommendation 1 should be WARNING",ocorrencia.isError());
  172 +
  173 + }
  174 +
  175 + }
  176 +
  177 + @Test
  178 + public void shouldCheckRecommedation8() {
  179 +
  180 + StringBuilder html = new StringBuilder("<html>\n")
  181 + .append("<p id=\"menu\">")
  182 + .append("<a href=\"#menu\">Go to menu</a></br>")
  183 + .append("<a href=\"home.html\">Home</a></br>")
  184 + .append("<a href=\"sarche.html\">Searche</a></br>")
  185 + .append("<a href=\"sitemap.html\">Site Map</a></br>")
  186 + .append("</p>")
  187 + .append("</html>");
  188 +
  189 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  190 + .with(marking().recommendation8()).check();
  191 +
  192 + assertEquals("Deve retornar 3 ocorrencia",3, occurrences.get(OccurrenceClassification.MARK).size());
  193 +
  194 + for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) {
  195 + assertEquals("Should return Recommendation 8 occurrence","8",ocorrencia.getCode());
  196 + assertTrue("Recommendation 1 should be ERROR",ocorrencia.isError());
  197 + }
  198 + }
  199 +
  200 + @Test
  201 + public void shouldNotReturnRecommendationOccurrence8() {
  202 +
  203 + StringBuilder html = new StringBuilder("<html>\n")
  204 + .append("<ul id=\"menu\">")
  205 + .append("<li> <a href=\"home.html\">Home</a></li>")
  206 + .append("<li> <a href=\"search.html\">Search</a></li>")
  207 + .append("<li> <a href=\"sitemap.html\">Site Map</a></li>")
  208 + .append("</ul>")
  209 + .append("</html>");
  210 +
  211 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  212 + .with(marking().recommendation8()).check();
  213 +
  214 + assertEquals("Shoud not return occurrences",0, occurrences.get(OccurrenceClassification.MARK).size());
  215 + }
  216 +
  217 + @Test
  218 + public void shouldCheckRecommedation9WithError() {
  219 + StringBuilder html = new StringBuilder("<html>\n")
  220 + .append("<p id=\"menu\">")
  221 + .append("<a href=\"test.html\" target=\"_blank\">New Window</a>")
  222 + .append("<a href=\"test2.html\" target=\"_blank\">New Window 2</a>")
  223 + .append("</html>");
  224 +
  225 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  226 + .with(marking().recommendation9()).check();
  227 +
  228 + assertEquals("Should return 2 occurrences",2, occurrences.get(OccurrenceClassification.MARK).size());
  229 +
  230 + for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) {
  231 + assertEquals("Should return Recommendation 9 occurrence","9",ocorrencia.getCode());
  232 + assertTrue("Recommendation 8 should be ERROR",ocorrencia.isError());
  233 + }
  234 + }
  235 +
  236 + @Test
  237 + public void shouldCheckRecommedation9ComoWarning() {
  238 + StringBuilder html = new StringBuilder("<html>\n")
  239 + .append("<p id=\"menu\">")
  240 + .append("<a href=\"teste.html\">teste 1</a>")
  241 + .append("<a href=\"teste2.html\">teste 2</a>")
  242 + .append("</html>");
  243 +
  244 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  245 + .with(marking().recommendation9()).check();
  246 +
  247 + assertEquals("Should return 1 occurrence",1, occurrences.get(OccurrenceClassification.MARK).size());
  248 + assertEquals("Should return Recommendation 9 occurrence","9",occurrences.get(OccurrenceClassification.MARK).get(0).getCode());
  249 + assertFalse("Recommendation 9 should be WARNING to html without target blank links",occurrences.get(OccurrenceClassification.MARK).get(0).isError());
  250 + }
  251 +
  252 +
  253 +}
... ...
src/test/java/br/com/checker/emag/MultimediaEvaluationTest.java 0 → 100644
  1 +++ a/src/test/java/br/com/checker/emag/MultimediaEvaluationTest.java
... ... @@ -0,0 +1,115 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import static br.com.checker.emag.core.Checker.content;
  4 +import static br.com.checker.emag.core.Checker.from;
  5 +import static br.com.checker.emag.core.Checker.multimedia;
  6 +import static org.junit.Assert.*;
  7 +
  8 +
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +import org.junit.Test;
  13 +import org.junit.runner.RunWith;
  14 +import org.junit.runners.JUnit4;
  15 +
  16 +import br.com.checker.emag.Occurrence;
  17 +import br.com.checker.emag.OccurrenceClassification;
  18 +
  19 +@RunWith(JUnit4.class)
  20 +public class MultimediaEvaluationTest {
  21 +
  22 +
  23 + @Test
  24 + public void shouldCheckRecommedation33() {
  25 + StringBuilder html = new StringBuilder("<html>");
  26 + html.append("<embed></embed>");
  27 + html.append("<object></object>");
  28 + html.append("<object value=\"teste.mp4\"></object>");
  29 + html.append("<object value=\"teste.avi\"></object>");
  30 + html.append("<object value=\"teste.flv\"></object>");
  31 + html.append("<object value=\"teste.rmvb\"></object>");
  32 + html.append("</html>");
  33 +
  34 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  35 + .with(multimedia().recommendation33()).check();
  36 +
  37 + assertEquals("Should return 5 occurrences", 5,occurrences.get(OccurrenceClassification.MULTIMEDIA).size());
  38 +
  39 + for(Occurrence occurrence :occurrences.get(OccurrenceClassification.MULTIMEDIA) ) {
  40 + assertEquals("Should return Recommendation 33","33",occurrence.getCode());
  41 + assertFalse("Recommendation 33 should be WARNING",occurrence.isError());
  42 + }
  43 + }
  44 +
  45 + @Test
  46 + public void shouldCheckRecommedation34() {
  47 + StringBuilder html = new StringBuilder("<html>");
  48 + html.append("<object></object>");
  49 + html.append("<object data=\"teste.mp3\"></object>");
  50 + html.append("<object data=\"teste.wma\"></object>");
  51 + html.append("<object data=\"teste.wav\"></object>");
  52 + html.append("</html>");
  53 +
  54 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  55 + .with(multimedia().recommendation34()).check();
  56 +
  57 + assertEquals("Should return 3 occurrences", 3,occurrences.get(OccurrenceClassification.MULTIMEDIA).size());
  58 +
  59 + for(Occurrence occurrence :occurrences.get(OccurrenceClassification.MULTIMEDIA) ) {
  60 + assertEquals("Should return Recommendation 34","34",occurrence.getCode());
  61 + assertFalse("Recommendation 34 should be WARNING",occurrence.isError());
  62 + }
  63 + }
  64 +
  65 + @Test
  66 + public void shouldCheckRecommedation35() {
  67 + StringBuilder html = new StringBuilder("<html>");
  68 + html.append("<embed></embed>");
  69 + html.append("<embed></embed>");
  70 + html.append("<object></object>");
  71 + html.append("<object value=\"teste.mp4\"></object>");
  72 + html.append("<object value=\"teste.avi\"></object>");
  73 + html.append("<object value=\"teste.flv\"></object>");
  74 + html.append("<object value=\"teste.rmvb\"></object>");
  75 + html.append("</html>");
  76 +
  77 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  78 + .with(multimedia().recommendation35()).check();
  79 +
  80 + assertEquals("Should return 7 occurrences", 7,occurrences.get(OccurrenceClassification.MULTIMEDIA).size());
  81 +
  82 + for(Occurrence occurrence :occurrences.get(OccurrenceClassification.MULTIMEDIA) ) {
  83 + assertEquals("Should return Recommendation 35","35",occurrence.getCode());
  84 + assertFalse("Recommendation 35 should be WARNING",occurrence.isError());
  85 + }
  86 + }
  87 +
  88 + @Test
  89 + public void shouldAlwaysCheckRecommendation36() {
  90 + StringBuilder html = new StringBuilder("<html></html>");
  91 +
  92 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  93 + .with(multimedia().recommendation36()).check();
  94 + assertEquals("Should return 1 occurrence", 1,occurrences.get(OccurrenceClassification.MULTIMEDIA).size());
  95 + assertEquals("Should return Recommendation 36 ","36",occurrences.get(OccurrenceClassification.MULTIMEDIA).get(0).getCode());
  96 + assertFalse("Recommendation 36 should be WARNING",occurrences.get(OccurrenceClassification.MULTIMEDIA).get(0).isError());
  97 +
  98 + }
  99 +
  100 + @Test
  101 + public void shouldCheckRecommedation37() {
  102 + StringBuilder html = new StringBuilder("<html>");
  103 + html.append("<object width=\"400\" height=\"50\" data=\"bookmark.swf\"></object> ");
  104 + html.append("</html>");
  105 +
  106 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  107 + .with(multimedia().recommendation37()).check();
  108 +
  109 + assertEquals("Should return 1 occurrences 1", 1,occurrences.get(OccurrenceClassification.MULTIMEDIA).size());
  110 + assertEquals("Should return Recommendation 37","37",occurrences.get(OccurrenceClassification.MULTIMEDIA).get(0).getCode());
  111 + assertFalse("Recommendation 37 should be WARNING",occurrences.get(OccurrenceClassification.MULTIMEDIA).get(0).isError());
  112 + }
  113 +
  114 +
  115 +}
... ...
src/test/java/br/com/checker/emag/PresentationEvaluationTest.java 0 → 100644
  1 +++ a/src/test/java/br/com/checker/emag/PresentationEvaluationTest.java
... ... @@ -0,0 +1,149 @@
  1 +package br.com.checker.emag;
  2 +
  3 +import static br.com.checker.emag.core.Checker.from;
  4 +import static br.com.checker.emag.core.Checker.presentation;
  5 +import static org.junit.Assert.*;
  6 +
  7 +
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.junit.Test;
  12 +import org.junit.runner.RunWith;
  13 +import org.junit.runners.JUnit4;
  14 +
  15 +import br.com.checker.emag.Occurrence;
  16 +import br.com.checker.emag.OccurrenceClassification;
  17 +
  18 +@RunWith(JUnit4.class)
  19 +public class PresentationEvaluationTest {
  20 +
  21 +
  22 + @Test
  23 + public void shouldCheckRecomendation28() {
  24 + StringBuilder html = new StringBuilder("<html");
  25 + html.append("<body bgcolor=\"#000\">")
  26 + .append(" <table bgcolor=\"#000\">")
  27 + .append(" <tr bgcolor=\"#000\">")
  28 + .append(" <td bgcolor=\"#000\">")
  29 + .append(" <td>")
  30 + .append(" </tr>")
  31 + .append(" </table>")
  32 + .append("</body>")
  33 + .append("</html>");
  34 +
  35 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  36 + .with(presentation().recommendation28()).check();
  37 +
  38 + assertEquals("Should return 4 occurrences",4,occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).size());
  39 +
  40 + for(Occurrence occurrence : occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN)) {
  41 + assertEquals("Should return Recommendation 28 occurrence","28",occurrence.getCode());
  42 + assertTrue("Recomerndation 28 should be Error", occurrence.isError());
  43 + }
  44 +
  45 + }
  46 +
  47 + @Test
  48 + public void shouldCheckRecomendation28WithWarning() {
  49 + StringBuilder html = new StringBuilder("<html");
  50 + html.append("<body>")
  51 + .append(" <table>")
  52 + .append(" <tr>")
  53 + .append(" <td>")
  54 + .append(" <td>")
  55 + .append(" </tr>")
  56 + .append(" </table>")
  57 + .append("</body>")
  58 + .append("</html>");
  59 +
  60 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  61 + .with(presentation().recommendation28()).check();
  62 +
  63 + assertEquals("Should return 1 occurrences",1,occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).size());
  64 + assertFalse("Recommendation 28 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError());
  65 +
  66 + }
  67 +
  68 + @Test
  69 + public void shouldCheckRecomendation29() {
  70 + StringBuilder html = new StringBuilder("<html");
  71 + html.append("<body bgcolor=\"#000\">")
  72 + .append(" <table bgcolor=\"#000\">")
  73 + .append(" <tr bgcolor=\"#000\">")
  74 + .append(" <td bgcolor=\"#000\">")
  75 + .append(" <td>")
  76 + .append(" </tr>")
  77 + .append(" </table>")
  78 + .append("</body>")
  79 + .append("</html>");
  80 +
  81 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  82 + .with(presentation().recommendation29()).check();
  83 +
  84 + assertEquals("Should return 4 occurrences",4,occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).size());
  85 +
  86 + for(Occurrence occurrence : occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN)) {
  87 + assertEquals("Should return Recommendation 98 occurrence","29",occurrence.getCode());
  88 + assertTrue("Recomerndation 29 should be Error", occurrence.isError());
  89 + }
  90 +
  91 + }
  92 +
  93 + @Test
  94 + public void shouldCheckRecomendation29WithWarning() {
  95 + StringBuilder html = new StringBuilder("<html");
  96 + html.append("<body>")
  97 + .append(" <table>")
  98 + .append(" <tr>")
  99 + .append(" <td>")
  100 + .append(" <td>")
  101 + .append(" </tr>")
  102 + .append(" </table>")
  103 + .append("</body>")
  104 + .append("</html>");
  105 +
  106 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  107 + .with(presentation().recommendation29()).check();
  108 +
  109 + assertEquals("Should return 1 occurrences",1,occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).size());
  110 + assertFalse("Recommendation 29 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError());
  111 +
  112 + }
  113 +
  114 + @Test
  115 + public void shouldAlwaysCheckRecommendation30() {
  116 + StringBuilder html = new StringBuilder("<html></html>");
  117 +
  118 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  119 + .with(presentation().recommendation30()).check();
  120 +
  121 + assertEquals("Should return Recommendation 30 ","30",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).getCode());
  122 + assertFalse("Recommendation 30 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError());
  123 +
  124 + }
  125 +
  126 + @Test
  127 + public void shouldAlwaysCheckRecommendation31() {
  128 + StringBuilder html = new StringBuilder("<html></html>");
  129 +
  130 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  131 + .with(presentation().recommendation31()).check();
  132 +
  133 + assertEquals("Should return Recommendation 31 ","31",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).getCode());
  134 + assertFalse("Recommendation 31 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError());
  135 +
  136 + }
  137 +
  138 + @Test
  139 + public void shouldAlwaysCheckRecommendation32() {
  140 + StringBuilder html = new StringBuilder("<html></html>");
  141 +
  142 + Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString())
  143 + .with(presentation().recommendation32()).check();
  144 +
  145 + assertEquals("Should return Recommendation 32 ","32",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).getCode());
  146 + assertFalse("Recommendation 32 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError());
  147 +
  148 + }
  149 +}
... ...
target/classes/META-INF/MANIFEST.MF 0 → 100644
  1 +++ a/target/classes/META-INF/MANIFEST.MF
... ... @@ -0,0 +1,5 @@
  1 +Manifest-Version: 1.0
  2 +Built-By: rodrigolima
  3 +Build-Jdk: 1.6.0_65
  4 +Created-By: Maven Integration for Eclipse
  5 +
... ...
target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.properties 0 → 100644
  1 +++ a/target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.properties
... ... @@ -0,0 +1,7 @@
  1 +#Generated by Maven Integration for Eclipse
  2 +#Sun Mar 30 20:08:18 BRT 2014
  3 +version=1.0
  4 +groupId=br.com.checker.emag
  5 +m2e.projectName=emag-checker
  6 +m2e.projectLocation=/Users/rodrigolima/workspace2/AvaliadorEmag/avaliador-emag
  7 +artifactId=emag-checker
... ...
target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.xml 0 → 100644
  1 +++ a/target/classes/META-INF/maven/br.com.checker.emag/emag-checker/pom.xml
... ... @@ -0,0 +1,50 @@
  1 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3 + <modelVersion>4.0.0</modelVersion>
  4 + <groupId>br.com.checker.emag</groupId>
  5 + <artifactId>emag-checker</artifactId>
  6 + <packaging>jar</packaging>
  7 + <version>1.0</version>
  8 + <name>Emag Checker</name>
  9 + <url>http://maven.apache.org</url>
  10 + <dependencies>
  11 + <dependency>
  12 + <groupId>junit</groupId>
  13 + <artifactId>junit</artifactId>
  14 + <version>4.11</version>
  15 + <scope>test</scope>
  16 + </dependency>
  17 + <dependency>
  18 + <groupId>net.htmlparser.jericho</groupId>
  19 + <artifactId>jericho-html</artifactId>
  20 + <version>3.1</version>
  21 + <scope>compile</scope>
  22 + </dependency>
  23 +
  24 + <dependency>
  25 + <groupId>org.apache.commons</groupId>
  26 + <artifactId>commons-lang3</artifactId>
  27 + <version>3.0</version>
  28 + </dependency>
  29 +
  30 + <dependency>
  31 + <groupId>org.projectlombok</groupId>
  32 + <artifactId>lombok</artifactId>
  33 + <version>0.12.0</version>
  34 + <scope>provided</scope>
  35 + </dependency>
  36 +
  37 + <dependency>
  38 + <groupId>xstream</groupId>
  39 + <artifactId>xstream</artifactId>
  40 + <version>1.2.2</version>
  41 + </dependency>
  42 +
  43 + <dependency>
  44 + <groupId>org.ogce</groupId>
  45 + <artifactId>xpp3</artifactId>
  46 + <version>1.1.6</version>
  47 + </dependency>
  48 +
  49 + </dependencies>
  50 +</project>
... ...
target/classes/br/com/checker/emag/Occurrence.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/OccurrenceClassification.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/SummarizedOccurrence$Builder.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/SummarizedOccurrence.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$BehaviorEvaluationBuilder.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$EvaluationRecommendation10.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$EvaluationRecommendation11.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$EvaluationRecommendation12.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$EvaluationRecommendation13.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$EvaluationRecommendation14.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation$EvaluationRecommendation15.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/BehaviorEvaluation.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/Checker$OccurrenceKey.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/Checker.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$ContentEvaluationBuilder.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation16.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation17.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation18.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation19.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation20.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation21.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation22.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation23.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation24.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation25.class 0 → 100644
No preview for this file type
target/classes/br/com/checker/emag/core/ContentEvaluation$EvaluationRecommendation26.class 0 → 100644
No preview for this file type