dropwizard/dropwizard

View on GitHub
dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.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(Size.bytes(0)).isEqualByComparingTo(Size.bytes(0));
        assertThat(Size.bytes(0)).isEqualByComparingTo(Size.kilobytes(0));
Severity: Major
Found in dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java - About 1 day to fix

    File SizeTest.java has 502 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/SizeTest.java - About 1 day to fix

      SizeTest has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @SuppressWarnings("deprecation")
      class SizeTest {
          @Test
          void convertsToTerabytes() {
              assertThat(Size.terabytes(2).toTerabytes())
      Severity: Minor
      Found in dropwizard-util/src/test/java/io/dropwizard/util/SizeTest.java - About 3 hrs to fix

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

            @Test
            void isComparable() {
                // both zero
                assertThat(Size.bytes(0)).isEqualByComparingTo(Size.bytes(0));
                assertThat(Size.bytes(0)).isEqualByComparingTo(Size.kilobytes(0));
        dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 265..602

        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 Size size = Size.megabytes(42L);
                final byte[] bytes;
                try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        dropwizard-util/src/test/java/io/dropwizard/util/DataSizeTest.java on lines 701..719
        dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 872..890

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

            @Test
            void parseSingleLetterSuffix() {
                assertThat(Size.parse("1B")).isEqualTo(Size.bytes(1));
                assertThat(Size.parse("1K")).isEqualTo(Size.kilobytes(1));
                assertThat(Size.parse("1M")).isEqualTo(Size.megabytes(1));
        dropwizard-util/src/test/java/io/dropwizard/util/DurationTest.java on lines 85..101

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

        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(Size.parse("2TB"))
                        .isEqualTo(Size.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 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 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(Size.parse("2MB"))
                        .isEqualTo(Size.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 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 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(Size.parse("2GB"))
                        .isEqualTo(Size.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 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 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(Size.parse("2KB"))
                        .isEqualTo(Size.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 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

        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 parsesBytes() {
                assertThat(Size.parse("2B"))
                        .isEqualTo(Size.bytes(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/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

        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