CloudSlang/cs-actions

View on GitHub
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java

Summary

Maintainability
B
6 hrs
Test Coverage

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

    @Test
    public void testWithTrimString() {
        final Map<String, String> result = d.execute("", "string", "astring");
        assertEquals(FAILURE, result.get(RETURN_CODE));
        assertTrue(result.get(RETURN_RESULT).contains("The provided string cannot be converted to a boolean value"));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 62..67

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

    @Test
    public void testWithTrimInitialString() {
        final Map<String, String> result = d.execute("initial", "string", "astring");
        assertEquals(FAILURE, result.get(RETURN_CODE));
        assertTrue(result.get(RETURN_RESULT).contains("The provided string cannot be converted to a boolean value"));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 55..60

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

    @Test
    public void testWithTrimTrue() {
        final Map<String, String> result = d.execute("   ", "string", "true");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("string", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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

    @Test
    public void testWithBlankString() {
        final Map<String, String> result = d.execute("   ", "string", "  ");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("string", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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

    @Test
    public void testWithEmptyString() {
        final Map<String, String> result = d.execute("", "string", "");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("string", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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

    @Test
    public void testHavingInitialString() {
        final Map<String, String> result = d.execute("initialstr", "string", "");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("initialstr", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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

    @Test
    public void testHavingInitialStringAndTrimFalse() {
        final Map<String, String> result = d.execute("initialstr", "string", "false");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("initialstr", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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

    @Test
    public void testHavingTrimVariableInUpperCase() {
        final Map<String, String> result = d.execute("initialstr", "string", "  TRUE     ");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("initialstr", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102

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

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

    @Test
    public void testHavingInitialStringAndTrimTrue() {
        final Map<String, String> result = d.execute("initialstr", "string", "true");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("initialstr", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 83..88
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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

    @Test
    public void testWithTrimFalse() {
        final Map<String, String> result = d.execute("", "string", "false");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("string", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 41..46
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 48..53
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 69..74
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 76..81
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 90..95
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 97..102
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 125..130

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

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
    public void testHavingInitialStringNull() {
        final Map<String, String> result = d.execute(null, "string", "false");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("string", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 118..123

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

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
    public void testHavingTrimVariableWrittenInLowerAndUpperCase() {
        final Map<String, String> result = d.execute(null, "string", "    fAlSE  ");
        assertEquals(SUCCESS, result.get(RETURN_CODE));
        assertEquals("string", result.get(RETURN_RESULT));
cs-utilities/src/test/java/io/cloudslang/content/utilities/DefaultIfEmptyTest.java on lines 111..116

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

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