CtrlK
BlogDocsLog inGet started
Tessl Logo

giuseppe-trisciuoglio/developer-kit

Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.

89

Quality

89%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Overview
Quality
Evals
Security
Files

edge-cases.mdplugins/developer-kit-java/skills/unit-test-utility-methods/references/

Edge Cases and Boundary Testing

Numeric Boundary Conditions

class MathUtilsEdgeCasesTest {

    @Test
    void shouldHandleMaxInteger() {
        assertThat(MathUtils.increment(Integer.MAX_VALUE)).isEqualTo(Integer.MAX_VALUE);
    }

    @Test
    void shouldHandleMinInteger() {
        assertThat(MathUtils.decrement(Integer.MIN_VALUE)).isEqualTo(Integer.MIN_VALUE);
    }

    @Test
    void shouldHandleLargeNumbers() {
        BigDecimal result = MathUtils.add(
            new BigDecimal("999999999999.99"),
            new BigDecimal("0.01")
        );
        assertThat(result).isEqualTo(new BigDecimal("1000000000000.00"));
    }

    @Test
    void shouldHandleFloatingPointPrecision() {
        assertThat(MathUtils.multiply(0.1, 0.2))
            .isCloseTo(0.02, within(0.0001));
    }
}

String Edge Cases

class StringUtilsEdgeCasesTest {

    @Test
    void shouldHandleNullInput() {
        assertThat(StringUtils.capitalize(null)).isNull();
    }

    @Test
    void shouldHandleEmptyString() {
        assertThat(StringUtils.capitalize("")).isEmpty();
    }

    @Test
    void shouldHandleSingleCharacter() {
        assertThat(StringUtils.capitalize("a")).isEqualTo("A");
    }

    @Test
    void shouldHandleUnicodeCharacters() {
        assertThat(StringUtils.capitalize("über")).isEqualTo("Über");
    }

    @Test
    void shouldHandleOnlyWhitespace() {
        assertThat(StringUtils.trim("   ")).isEmpty();
    }
}

Collection Edge Cases

class CollectionUtilsEdgeCasesTest {

    @Test
    void shouldReturnEmptyForNullInput() {
        assertThat(CollectionUtils.filter(null, n -> true)).isEmpty();
    }

    @Test
    void shouldReturnEmptyForNoMatches() {
        List<Integer> numbers = List.of(1, 3, 5);
        assertThat(CollectionUtils.filter(numbers, n -> n % 2 == 0)).isEmpty();
    }

    @Test
    void shouldHandleEmptyCollection() {
        assertThat(CollectionUtils.join(List.of(), "-")).isEmpty();
    }

    @Test
    void shouldHandleSingleElement() {
        assertThat(CollectionUtils.join(List.of("a"), "-")).isEqualTo("a");
    }
}

Validation Edge Cases

class ValidatorUtilsEdgeCasesTest {

    @Test
    void shouldRejectEmptyEmail() {
        assertThat(ValidatorUtils.isValidEmail("")).isFalse();
    }

    @Test
    void shouldRejectNullEmail() {
        assertThat(ValidatorUtils.isValidEmail(null)).isFalse();
    }

    @Test
    void shouldHandleLongStrings() {
        String longString = "a".repeat(10000);
        assertThat(StringUtils.truncate(longString, 100)).hasSize(100);
    }

    @Test
    void shouldHandleSpecialCharactersInUrls() {
        assertThat(ValidatorUtils.isValidUrl("https://example.com/path?query=value"))
            .isTrue();
    }
}

Floating Point Precision Rules

OperationUseExample
AdditionisCloseTo(delta)isCloseTo(0.3, within(0.001))
ComparisonisEqualTo()Use BigDecimal for exact decimals
PercentageTolerance-basedisCloseTo(expected, within(0.01))

plugins

developer-kit-java

skills

unit-test-utility-methods

README.md

CHANGELOG.md

context7.json

CONTRIBUTING.md

README_CN.md

README_ES.md

README_IT.md

README.md

tessl.json

tile.json