You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Felix Schumacher <fe...@internetallee.de> on 2017/03/27 08:24:41 UTC

Re: svn commit: r1788769 - /jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestCssParser.java

Am 26.03.2017 21:13, schrieb pmouawad@apache.org:
> Author: pmouawad
> Date: Sun Mar 26 19:13:21 2017
> New Revision: 1788769
> 
> URL: http://svn.apache.org/viewvc?rev=1788769&view=rev
> Log:
> Add Test for parsing errors
> 
> Modified:
> 
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestCssParser.java
> 
> Modified:
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestCssParser.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestCssParser.java?rev=1788769&r1=1788768&r2=1788769&view=diff
> ==============================================================================
> ---
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestCssParser.java
> (original)
> +++
> jmeter/trunk/test/src/org/apache/jmeter/protocol/http/parser/TestCssParser.java
> Sun Mar 26 19:13:21 2017
> @@ -31,7 +31,14 @@ import org.hamcrest.CoreMatchers;
>  import org.junit.Test;
> 
>  public class TestCssParser extends JMeterTestCase {
> -
> +
> +    private static final String CSS_IN_ERROR = "@-webkit-keyframes

Would CSS_WITH_ERRORS be a better name?

> \"introjspulse\"{"
> +            + "0%{-webkit-transform:scale(0);opacity:.0}"
> +            + "25%{-webkit-transform:scale(0);opacity:.1}"
> +            + "50%{-webkit-transform:scale(0.1);opacity:.3}"
> +            + "75%{-webkit-transform:scale(0.5);opacity:.5}"
> +            + "100%{-webkit-transform:scale(1);opacity:.0}}";
> +
>      private final CssParser parser = new CssParser();
> 
>      @Test
> @@ -47,6 +54,11 @@ public class TestCssParser extends JMete
>          result = extractUrls("@import 
> url(http://example.com/abc.css);");
>          assertThat(result.isEmpty(), CoreMatchers.is(false));
>      }
> +
> +    @Test(expected=LinkExtractorParseException.class)
> +    public void testGetEmbeddedResourceURLs() throws Exception {

You could probably rename the test to indicate, that you are handling 
broken css data. "testExtractUrlsFromBrokenData" or 
"testExtractUrlsWithInvalidData"?

Regards,
  Felix

> +        extractUrls(CSS_IN_ERROR);
> +    }
> 
>      @Test
>      public void testIsReusable() {