dropwizard/dropwizard

View on GitHub
dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java

Summary

Maintainability
F
2 wks
Test Coverage

Method isComparable has 275 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Test
    void isComparable() {
        // both zero
        assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.bytes(0));
        assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.kilobytes(0));
Severity: Major
Found in dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java - About 1 day to fix

    File DataSizeTest.java has 590 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package io.dropwizard.util;
    
    import com.fasterxml.jackson.databind.ObjectMapper;
    import org.junit.jupiter.api.Test;
    
    
    Severity: Major
    Found in dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java - About 1 day to fix

      DataSizeTest has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class DataSizeTest {
          @Test
          void convertsToPetabytes() {
              assertThat(DataSize.petabytes(2).toPetabytes())
                      .isEqualTo(2);
      Severity: Minor
      Found in dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java - About 4 hrs to fix

        Method serializesCorrectlyWithJackson has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Test
            void serializesCorrectlyWithJackson() throws IOException {
                final ObjectMapper mapper = new ObjectMapper();
        
                assertThat(mapper.writeValueAsString(DataSize.bytes(0L))).isEqualTo("\"0 bytes\"");
        Severity: Minor
        Found in dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java - About 1 hr to fix

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

              @Test
              void isComparable() {
                  // both zero
                  assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.bytes(0));
                  assertThat(DataSize.bytes(0)).isEqualByComparingTo(DataSize.kilobytes(0));
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 175..512

          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 5353.

          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 testSerialization() throws IOException, ClassNotFoundException {
                  final DataSize size = DataSize.kibibytes(42L);
                  final byte[] bytes;
                  try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 872..890
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 593..611

          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 107.

          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 10 locations. Consider refactoring.
          Open

              @Test
              void parsesBytes() {
                  assertThat(DataSize.parse("2B"))
                          .isEqualTo(DataSize.bytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 52..65
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 79..92
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 106..119
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 133..146
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 160..173
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 47..60
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 62..75
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 77..90
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 92..105

          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 75.

          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 10 locations. Consider refactoring.
          Open

              @Test
              void parsesGigabytes() {
                  assertThat(DataSize.parse("2G"))
                          .isEqualTo(DataSize.gigabytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 52..65
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 79..92
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 133..146
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 160..173
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 187..200
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 47..60
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 62..75
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 77..90
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 92..105

          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 75.

          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 10 locations. Consider refactoring.
          Open

              @Test
              void parsesPetabytes() {
                  assertThat(DataSize.parse("2P"))
                          .isEqualTo(DataSize.petabytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 79..92
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 106..119
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 133..146
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 160..173
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 187..200
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 47..60
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 62..75
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 77..90
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 92..105

          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 75.

          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 10 locations. Consider refactoring.
          Open

              @Test
              void parsesKilobytes() {
                  assertThat(DataSize.parse("2K"))
                          .isEqualTo(DataSize.kilobytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 52..65
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 79..92
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 106..119
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 133..146
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 187..200
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 47..60
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 62..75
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 77..90
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 92..105

          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 75.

          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 10 locations. Consider refactoring.
          Open

              @Test
              void parsesTerabytes() {
                  assertThat(DataSize.parse("2T"))
                          .isEqualTo(DataSize.terabytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 52..65
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 106..119
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 133..146
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 160..173
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 187..200
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 47..60
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 62..75
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 77..90
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 92..105

          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 75.

          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 10 locations. Consider refactoring.
          Open

              @Test
              void parsesMegabytes() {
                  assertThat(DataSize.parse("2M"))
                          .isEqualTo(DataSize.megabytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 52..65
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 79..92
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 106..119
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 160..173
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 187..200
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 47..60
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 62..75
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 77..90
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 92..105

          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 75.

          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 12 locations. Consider refactoring.
          Open

              @Test
              void parsesPebibytes() {
                  assertThat(DataSize.parse("2PiB"))
                          .isEqualTo(DataSize.pebibytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 94..104
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 121..131
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 148..158
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 175..185
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 61..71
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 73..83
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 103..113
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 115..125
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 127..137
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 139..149
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 107..117

          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 12 locations. Consider refactoring.
          Open

              @Test
              void parsesMebibytes() {
                  assertThat(DataSize.parse("2MiB"))
                          .isEqualTo(DataSize.mebibytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 67..77
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 94..104
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 121..131
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 175..185
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 61..71
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 73..83
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 103..113
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 115..125
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 127..137
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 139..149
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 107..117

          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 12 locations. Consider refactoring.
          Open

              @Test
              void parsesKibibytes() {
                  assertThat(DataSize.parse("2KiB"))
                          .isEqualTo(DataSize.kibibytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 67..77
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 94..104
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 121..131
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 148..158
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 61..71
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 73..83
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 103..113
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 115..125
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 127..137
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 139..149
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 107..117

          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 12 locations. Consider refactoring.
          Open

              @Test
              void parsesTebibytes() {
                  assertThat(DataSize.parse("2TiB"))
                          .isEqualTo(DataSize.tebibytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 67..77
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 121..131
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 148..158
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 175..185
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 61..71
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 73..83
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 103..113
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 115..125
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 127..137
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 139..149
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 107..117

          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 12 locations. Consider refactoring.
          Open

              @Test
              void parsesGibibytes() {
                  assertThat(DataSize.parse("2GiB"))
                          .isEqualTo(DataSize.gibibytes(2));
          
          
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 67..77
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 94..104
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 148..158
          dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 175..185
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 61..71
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 73..83
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 103..113
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 115..125
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 127..137
          dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 139..149
          dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java on lines 107..117

          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

          There are no issues that match your filters.

          Category
          Status