Commit ad2f79217e0c19b01c7b500eb99b1dcd03cefa2b
1 parent
362ff7e4
Exists in
master
and in
1 other branch
git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/ASES%20-%20Web/ASES%20-%2…
…0Web/Fontes/avaliador-api@10429 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Showing
4 changed files
with
68 additions
and
45 deletions
Show diff stats
src/test/java/br/com/checker/emag/BehaviorEvaluationTest.java
... | ... | @@ -118,6 +118,7 @@ public class BehaviorEvaluationTest { |
118 | 118 | StringBuilder html = new StringBuilder("<<html>") |
119 | 119 | .append("<head>") |
120 | 120 | .append("<title>teste</title>") |
121 | + .append("<meta http-equiv=\"refresh\" content=\"20; url='http://www.exemplo.com/'\" />") | |
121 | 122 | .append("</head>") |
122 | 123 | .append("</html>"); |
123 | 124 | ... | ... |
src/test/java/br/com/checker/emag/ContentEvaluationTest.java
... | ... | @@ -27,7 +27,7 @@ public class ContentEvaluationTest { |
27 | 27 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
28 | 28 | .with(content().recommendation17()).check(); |
29 | 29 | |
30 | - assertEquals("Should return 2 occurrences", 2,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); | |
30 | + assertEquals("Should return 3 occurrences", 3,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); | |
31 | 31 | assertEquals("Should return Recommendation 17 occurrence","3.1",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode()); |
32 | 32 | assertTrue("Recommendation 16 should be ERROR",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError()); |
33 | 33 | } |
... | ... | @@ -35,7 +35,7 @@ public class ContentEvaluationTest { |
35 | 35 | |
36 | 36 | @Test |
37 | 37 | public void shouldNotCheckRecommedation17() { |
38 | - StringBuilder html = new StringBuilder("<html lang=\"en\">"); | |
38 | + StringBuilder html = new StringBuilder("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">"); | |
39 | 39 | html.append("</html>"); |
40 | 40 | |
41 | 41 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
... | ... | @@ -50,7 +50,7 @@ public class ContentEvaluationTest { |
50 | 50 | html.append("</html>"); |
51 | 51 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
52 | 52 | .with(content().recommendation17()).check(); |
53 | - assertEquals("Should return 1 occurrences 1 ", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); | |
53 | + assertEquals("Should return 2 occurrences 2 ", 2,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); | |
54 | 54 | } |
55 | 55 | |
56 | 56 | @Test |
... | ... | @@ -164,7 +164,7 @@ public class ContentEvaluationTest { |
164 | 164 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
165 | 165 | .with(content().recommendation21()).check(); |
166 | 166 | |
167 | - assertEquals("Should return 15 occurrences", 15,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); | |
167 | + assertEquals("Should return 14 occurrences", 14,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); | |
168 | 168 | |
169 | 169 | for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.CONTENT_INFORMATION)) { |
170 | 170 | assertEquals("Should return Recommendation 21 occurrence","3.5",ocorrencia.getCode()); |
... | ... | @@ -331,7 +331,7 @@ public class ContentEvaluationTest { |
331 | 331 | html.append("<img src=\"/pasta/pasta/smiley.gif\" height=\"42\" width=\"42\">"); |
332 | 332 | html.append("<img src=\"/pasta/pasta/smiley.gif\" alt=\"imagem\" height=\"42\" width=\"42\">"); |
333 | 333 | html.append("<img src=\"/pasta/pasta/smiley.gif\" alt=\"alt\" height=\"42\" width=\"42\">"); |
334 | - html.append("<img src=\"/pasta/pasta/smiley.gif\" alt=\"descrição\" height=\"42\" width=\"42\">"); | |
334 | + html.append("<img src=\"/pasta/pasta/smiley.gif\" alt=\"descrição\" height=\"42\" width=\"42\">"); | |
335 | 335 | html.append("</body>"); |
336 | 336 | html.append("</html>"); |
337 | 337 | html.append("<html> "); |
... | ... | @@ -353,8 +353,8 @@ public class ContentEvaluationTest { |
353 | 353 | html.append("<head>"); |
354 | 354 | html.append("</head>"); |
355 | 355 | html.append(" <body>"); |
356 | - html.append("<img src=\"smiley.gif\" alt=\"arquivo descrição\" height=\"42\" width=\"42\">"); | |
357 | - html.append("<img src=\"/pasta/smiley.gif\" alt=\"arquivo descrição\" height=\"42\" width=\"42\">"); | |
356 | + html.append("<img src=\"smiley.gif\" alt=\"descrição\" height=\"42\" width=\"42\">"); | |
357 | + html.append("<img src=\"/pasta/smiley.gif\" alt=\"arquivo descrição\" height=\"42\" width=\"42\">"); | |
358 | 358 | html.append("</body>"); |
359 | 359 | html.append("</html>"); |
360 | 360 | html.append("<html> "); |
... | ... | @@ -364,7 +364,7 @@ public class ContentEvaluationTest { |
364 | 364 | |
365 | 365 | assertEquals("Should return 1 occurrences", 1,occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).size()); |
366 | 366 | assertEquals("Should return Recommendation 22","3.6",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).getCode()); |
367 | - assertFalse("Recommendation 22 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError()); | |
367 | + assertTrue("Recommendation 22 should be WARNING",occurrences.get(OccurrenceClassification.CONTENT_INFORMATION).get(0).isError()); | |
368 | 368 | } |
369 | 369 | |
370 | 370 | @Test |
... | ... | @@ -375,7 +375,7 @@ public class ContentEvaluationTest { |
375 | 375 | html.append("<head>"); |
376 | 376 | html.append("</head>"); |
377 | 377 | html.append(" <body>"); |
378 | - html.append("<img src=\"smiley.gif\" alt=\"arquivo descrição\" title=\"arquivo descrição\" height=\"42\" width=\"42\">"); | |
378 | + html.append("<img src=\"smiley.gif\" alt=\"arquivo descri��o\" title=\"arquivo descri��o\" height=\"42\" width=\"42\">"); | |
379 | 379 | html.append("</body>"); |
380 | 380 | html.append("</html>"); |
381 | 381 | html.append("<html> "); | ... | ... |
src/test/java/br/com/checker/emag/MarkEvaluationTest.java
... | ... | @@ -50,14 +50,31 @@ public class MarkEvaluationTest { |
50 | 50 | public void shouldAlwaysCheckRecommendation2() { |
51 | 51 | String a = " "; |
52 | 52 | StringBuilder html = new StringBuilder("<html>") |
53 | - .append("<head>") | |
53 | + .append("<img alt=\"\"/>") | |
54 | + .append("<p>") | |
55 | + .append("<img alt=\"\"/>") | |
56 | + .append("</p>") | |
57 | + .append("<p>") | |
58 | + .append("<img alt=\"teste\"/>") | |
59 | + .append("</p>") | |
60 | + .append("<h1>") | |
61 | + .append("<img alt=\"\"/>") | |
62 | + .append("</h1>") | |
63 | + .append("<a href=\"teste\">") | |
64 | + .append("<img alt=\"\"/>") | |
65 | + .append("</a>") | |
66 | + .append("<h2>") | |
67 | + .append("<img alt=\"\"/>") | |
68 | + .append("</h2>") | |
69 | + | |
70 | + /*.append("<head>") | |
54 | 71 | .append("</head>") |
55 | 72 | .append("<BODY>") |
56 | 73 | .append("<h1></h1>") |
57 | 74 | .append("<p style=\"color:green;margin-left:20px;\"></p>") |
58 | 75 | .append("<a> </a>") |
59 | 76 | .append("<a>"+a+"</a>") |
60 | - .append("</BODY>") | |
77 | + .append("</BODY>")*/ | |
61 | 78 | .append("</HTML>"); |
62 | 79 | |
63 | 80 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
... | ... | @@ -76,7 +93,7 @@ public class MarkEvaluationTest { |
76 | 93 | } |
77 | 94 | |
78 | 95 | assertEquals("Should return 4 erros",4,erros); |
79 | - assertEquals("Should return 3 warning",3,warnings); | |
96 | + assertEquals("Should return 10 warning",10,warnings); | |
80 | 97 | |
81 | 98 | } |
82 | 99 | |
... | ... | @@ -100,7 +117,7 @@ public class MarkEvaluationTest { |
100 | 117 | } |
101 | 118 | } |
102 | 119 | |
103 | - assertEquals("Should return 3 occurrence with criteitio 4",3,criterio4); | |
120 | + assertEquals("Should return 2 occurrence with criteitio 2",2,criterio4); | |
104 | 121 | } |
105 | 122 | |
106 | 123 | @Test |
... | ... | @@ -305,11 +322,11 @@ public class MarkEvaluationTest { |
305 | 322 | |
306 | 323 | @Test |
307 | 324 | public void shouldCheckCriterio1Recommedation5() { |
308 | - StringBuilder html = new StringBuilder("<html>\n") | |
309 | - .append("<a href=\"a\">link1</a>\n") | |
310 | - .append("<a href=\"a\">link3</a>\n") | |
311 | - .append("<a href=\"#b\">link5</a>\n") | |
312 | - .append("<a href=\"#c\">link5</a>\n") | |
325 | + StringBuilder html = new StringBuilder("<html>") | |
326 | + .append("<a href=\"a\">link1</a>") | |
327 | + .append("<a href=\"a\">link3</a>") | |
328 | + .append("<a href=\"#b\">link5</a>") | |
329 | + .append("<a href=\"#c\">link5</a>") | |
313 | 330 | .append("</html>"); |
314 | 331 | |
315 | 332 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
... | ... | @@ -328,7 +345,7 @@ public class MarkEvaluationTest { |
328 | 345 | |
329 | 346 | } |
330 | 347 | |
331 | - assertEquals("Should return 2 occurrence with criteitio 1",2,criterio1); | |
348 | + assertEquals("Should not return occurrence with criteitio 1",0,criterio1); | |
332 | 349 | |
333 | 350 | } |
334 | 351 | |
... | ... | @@ -347,34 +364,42 @@ public class MarkEvaluationTest { |
347 | 364 | int criterio2 = 0; |
348 | 365 | for(Occurrence ocorrencia : occurrences.get(OccurrenceClassification.MARK)) { |
349 | 366 | assertEquals("Should return Recommendation 5 occurrence","1.5",ocorrencia.getCode()); |
350 | - assertTrue("Recommendation 1 should be ERROR",ocorrencia.isError()); | |
351 | - if(ocorrencia.getCriterio().equals("2")) | |
367 | + | |
368 | + if(ocorrencia.getCriterio().equals("3")) | |
369 | + assertTrue("Recommendation 5 criteitio 3 should be ERROR",ocorrencia.isError()); | |
370 | + | |
371 | + if(ocorrencia.getCriterio().equals("4")) | |
372 | + assertFalse("Recommendation 5 criteitio 4 not ERROR",ocorrencia.isError()); | |
373 | + | |
374 | + if(ocorrencia.getCriterio().equals("2")){ | |
375 | + assertTrue("Recommendation 5 criteitio 2 should be ERROR",ocorrencia.isError()); | |
352 | 376 | criterio2++; |
377 | + } | |
353 | 378 | } |
354 | 379 | |
355 | - assertEquals("Should return 1 occurrence with criteitio 1",1,criterio2); | |
380 | + assertEquals("Should return 1 occurrence with criteitio 2",1,criterio2); | |
356 | 381 | |
357 | 382 | } |
358 | 383 | |
359 | 384 | @Test |
360 | 385 | public void shouldCheckCriterio3Recommedation5() { |
361 | - StringBuilder html = new StringBuilder("<html>\n") | |
386 | + StringBuilder html = new StringBuilder("<html>") | |
362 | 387 | |
363 | - .append("<a>link</a>\n") | |
364 | - .append("<area>area</area>\n") | |
365 | - .append("<button>button</button>\n") | |
366 | - .append("<input></input>\n") | |
367 | - .append("<label>label</a>\n") | |
368 | - .append("<fieldset><legend>legend</legend></fieldset>\n") | |
369 | - .append("<textarea></textarea>\n") | |
370 | - | |
371 | - .append("<a accesskey=\"acess0\">link</a>\n") | |
372 | - .append("<area accesskey=\"acess1\">area</area>\n") | |
373 | - .append("<button accesskey=\"acess2\">button</button>\n") | |
374 | - .append("<input accesskey=\"acess3\"></input>\n") | |
375 | - .append("<label accesskey=\"acess4\">label</a>\n") | |
376 | - .append("<fieldset><legend accesskey=\"acess5\">legend</legend></fieldset>\n") | |
377 | - .append("<textarea accesskey=\"acess6\"></textarea>\n") | |
388 | + .append("<a>link</a>") | |
389 | + .append("<area>area</area>") | |
390 | + .append("<button>button</button>") | |
391 | + .append("<input></input>") | |
392 | + .append("<label>label</a>") | |
393 | + .append("<fieldset><legend>legend</legend></fieldset>") | |
394 | + .append("<textarea></textarea>") | |
395 | + | |
396 | + /*.append("<a accesskey=\"acess0\">link</a>") | |
397 | + .append("<area accesskey=\"acess1\">area</area>") | |
398 | + .append("<button accesskey=\"acess2\">button</button>") | |
399 | + .append("<input accesskey=\"acess3\"></input>") | |
400 | + .append("<label accesskey=\"acess4\">label</a>") | |
401 | + .append("<fieldset><legend accesskey=\"acess5\">legend</legend></fieldset>") | |
402 | + .append("<textarea accesskey=\"acess6\"></textarea>")*/ | |
378 | 403 | .append("</html>"); |
379 | 404 | |
380 | 405 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
... | ... | @@ -391,7 +416,7 @@ public class MarkEvaluationTest { |
391 | 416 | } |
392 | 417 | } |
393 | 418 | |
394 | - assertEquals("Should return 7 occurrence with criteitio 3",7,criterio3); | |
419 | + assertEquals("Should return 1 occurrence with criteitio 1",1,criterio3); | |
395 | 420 | |
396 | 421 | } |
397 | 422 | |
... | ... | @@ -519,9 +544,6 @@ public class MarkEvaluationTest { |
519 | 544 | StringBuilder html = new StringBuilder("<!DOCTYPE html>") |
520 | 545 | .append("<html>\n") |
521 | 546 | .append("<HEADER></HEADER>\n") |
522 | - .append("<NAV></NAV>\n") | |
523 | - .append("<SECTION></SECTION>\n") | |
524 | - .append("<FOOTER></FOOTER>\n") | |
525 | 547 | .append("</html>"); |
526 | 548 | |
527 | 549 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) |
... | ... | @@ -589,7 +611,7 @@ public class MarkEvaluationTest { |
589 | 611 | StringBuilder html = new StringBuilder("<html>\n") |
590 | 612 | .append("<p id=\"menu\">") |
591 | 613 | .append("<a href=\"teste.html\">teste 1</a>") |
592 | - .append("<a href=\"teste2.html\">teste 2</a>") | |
614 | + .append("<a href=\"teste2.html\" target=\"_blank\">teste 2</a>") | |
593 | 615 | .append("</html>"); |
594 | 616 | |
595 | 617 | Map<OccurrenceClassification,List<Occurrence>> occurrences = from(html.toString()) | ... | ... |
src/test/java/br/com/checker/emag/PresentationEvaluationTest.java
... | ... | @@ -50,7 +50,7 @@ public class PresentationEvaluationTest { |
50 | 50 | StringBuilder html = new StringBuilder("<html"); |
51 | 51 | html.append("<body>") |
52 | 52 | .append(" <table>") |
53 | - .append(" <tr>") | |
53 | + .append(" <tr bgcolor=\"#E6E6FA\">") | |
54 | 54 | .append(" <td>") |
55 | 55 | .append(" <td>") |
56 | 56 | .append(" </tr>") |
... | ... | @@ -62,7 +62,7 @@ public class PresentationEvaluationTest { |
62 | 62 | .with(presentation().recommendation29()).check(); |
63 | 63 | |
64 | 64 | assertEquals("Should return 1 occurrences",1,occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).size()); |
65 | - assertFalse("Recommendation 29 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError()); | |
65 | + assertTrue("Recommendation 29 should be WARNING",occurrences.get(OccurrenceClassification.PRESENTATION_DESIGN).get(0).isError()); | |
66 | 66 | |
67 | 67 | } |
68 | 68 | ... | ... |