dropwizard/dropwizard

View on GitHub
dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java

Summary

Maintainability
D
3 days
Test Coverage

File AssetServletTest.java has 449 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.dropwizard.servlets.assets;

import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpTester;
import org.eclipse.jetty.http.HttpVersion;

    AssetServletTest has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class AssetServletTest {
        private static final String DUMMY_SERVLET = "/dummy_servlet/";
        private static final String NOINDEX_SERVLET = "/noindex_servlet/";
        private static final String NOCHARSET_SERVLET = "/nocharset_servlet/";
        private static final String NOMEDIATYPE_SERVLET = "/nomediatype_servlet/";

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          @Test
          void supportsFinalByteRange() throws Exception {
              request.setURI(ROOT_SERVLET + "assets/example.txt");
              request.setHeader(HttpHeader.RANGE.asString(), "bytes=10-10");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 355..377

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 223.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          @Test
          void supportsMultipleByteRanges() throws Exception {
              request.setURI(ROOT_SERVLET + "assets/example.txt");
              request.setHeader(HttpHeader.RANGE.asString(), "bytes=0-0,-1");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 307..329

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 223.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          @Test
          void defaultsToHtml() throws Exception {
              request.setURI(DUMMY_SERVLET + "foo.bar");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 447..455
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 457..465

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 71.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          @Test
          void servesWithDefaultMediaType() throws Exception {
              request.setURI(MEDIATYPE_SERVLET + "foo.bar");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 437..445
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 447..455

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 71.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          @Test
          void defaultsToHtmlIfNotOverridden() throws Exception {
              request.setURI(NOMEDIATYPE_SERVLET + "foo.bar");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 437..445
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 457..465

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 71.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          @Test
          void servesFilesMappedToRoot() throws Exception {
              request.setURI(ROOT_SERVLET + "assets/example.txt");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 143..151

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          @Test
          void servesFilesFromRootsWithSameName() throws Exception {
              request.setURI(DUMMY_SERVLET + "example2.txt");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 116..124

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @Test
          void throws404IfTheAssetIsMissing() throws Exception {
              request.setURI(DUMMY_SERVLET + "doesnotexist.txt");
      
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 515..521
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 523..529
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 531..537

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @Test
          void doesNotAllowOverridingUrls() throws Exception {
              request.setURI(DUMMY_SERVLET + "file:/etc/passwd");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 181..188
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 523..529
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 531..537

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @Test
          void allowsEncodedAssetNames() throws Exception {
              request.setURI(DUMMY_SERVLET + "encoded%20example.txt");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 181..188
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 515..521
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 523..529

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @Test
          void doesNotAllowOverridingPaths() throws Exception {
              request.setURI(DUMMY_SERVLET + "/etc/passwd");
              response = HttpTester.parseResponse(SERVLET_TESTER.getResponses(request.generate()));
              assertThat(response.getStatus())
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 181..188
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 515..521
      dropwizard-servlets/src/test/java/io/dropwizard/servlets/assets/AssetServletTest.java on lines 531..537

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status