Skip to content

[test-enhancer] Add tests for NamingHelper and TokenHelper #68

@github-actions

Description

@github-actions

This issue tracks the test files generated by the test-enhancer agent for NamingHelper and TokenHelper, two static utility classes with 0% coverage before this run.

Coverage Before

Class Coverage Before
CobolToQuarkusMigration.Helpers.NamingHelper 0%
CobolToQuarkusMigration.Helpers.TokenHelper 0%

Test Files Generated

Two new test files were created locally on branch test-enhancer/naming-helper-token-helper but could not be pushed due to missing git credentials in the runner environment.

CobolToQuarkusMigration.Tests/Helpers/NamingHelperTests.cs

34 tests covering:

  • ToPascalCase — normal input, separator chars, null/empty/whitespace
  • DeriveClassNameFromCobolFile — standard COBOL names, underscore-separated, digit-start, empty/null
  • GetFallbackClassName — appends Fallback suffix
  • GetOutputFileName.cs and .java extensions
  • IsValidIdentifier — valid identifiers, digit-start, hyphens, spaces
  • IsSemanticClassName — semantic suffixes, generic names, null/empty
  • ExtractCSharpClassName — valid class, generic class fallback, no class declaration
  • ExtractJavaClassName — public class, generic class fallback
  • ReplaceGenericClassName — class declaration, constructor calls, same-name no-op

CobolToQuarkusMigration.Tests/Helpers/TokenHelperTests.cs

34 tests covering:

  • EstimateTokens — null/empty returns 0, positive count, longer = more tokens
  • EstimateCobolTokens — null/empty, positive count
  • TruncateToTokenLimit — empty, within limit, exceeds limit, preserve start/end
  • TruncateCobolIntelligently — empty, within limit, large content
  • CalculateRequestDelay — normal limits, minimum, maximum cap, zero limit
  • GetRateLimitSummary — non-empty output
  • Constants CharsPerToken and SafetyMargin

All 68 new tests pass. The 15 pre-existing failures in CopilotChatClientTests are unrelated (async disposal issue) and were already failing before this run.

Next Recommended Targets

  1. CobolToQuarkusMigration.Chunking.Core.NamingConventionEnforcer — pure logic, no external deps
  2. CobolToQuarkusMigration.Helpers.RateLimiter — needs careful async mocking
  3. CobolToQuarkusMigration.Helpers.FileHelper — file system interactions, mockable

To Apply

Apply the generated tests manually or re-run the test-enhancer agent (cache memory has been updated to skip already-processed targets).

Generated by Test Enhancement Agent

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions