Skip to content

Conversation

@Vuk7912
Copy link

@Vuk7912 Vuk7912 commented Jun 28, 2025

Implement Todo Item Title Validation

Description

Task

Add validation mechanism for title input before saving todo item

Acceptance Criteria

  • Title cannot be empty
  • Title cannot be null
  • Title cannot be just whitespace
  • Validation mechanism prevents saving invalid todo items

Summary of Work

This pull request implements robust validation for todo item titles to ensure data integrity and prevent empty or invalid entries.

Changes Made

  • Added isValidTitle() method to validate todo item titles
  • Implemented null-safety checks for title input
  • Created validateTitle() method to enforce validation rules
  • Added comprehensive test cases to cover various validation scenarios

Implementation Details

  • isValidTitle() checks if the title is:
    1. Not null
    2. Not an empty string
    3. Not just whitespace
  • validateTitle() throws an IllegalArgumentException for invalid titles
  • Null-safe implementation using Kotlin's built-in null checking

Testing Approach

  • Unit tests cover the following scenarios:
    1. Valid title with content
    2. Empty title
    3. Null title
    4. Whitespace-only title
    5. Validation method throws exception for invalid titles
  • 100% code coverage for validation logic

Notes

  • Validation is implemented as a Kotlin object for easy reuse
  • Follows fail-fast principle by immediately rejecting invalid inputs
  • Provides clear error messaging for invalid titles

Changes Made

  • Added isValidTitle() method to check title validity
  • Implemented validateTitle() to enforce validation rules
  • Added null-safety checks for title input

Tests

  • Validate title with content returns true
  • Empty title returns false
  • Null title returns false
  • Whitespace-only title returns false
  • Validation method throws exception for invalid titles

Signatures

Staking Key

3oBzgQ4y8YtmkxYGkse1fKKefi25twpMKU9BBdsYtjDQ: 8bxgVdEFt6XHYedyc5F1BoDN65KqGS3ymFVPtKzGyyXotUdmv3TJPNz5gpgoKTExx3tLovwp8Ms2w6ruNnCWfoGtauiyDZUcUn4MhvYFSFWYXRWZMehEBqXE4HPcqZhrucW3vjvU2RjZjQDScPuMWgsLnWR8E3YtXyyfg6phR4YDgXxzCMurZ7NWVTYQBCHGdA9ZabDckmEHtGGFvfUyChTM6PVxxHSiqyLHniyD2hV6nbAk55DQBPihLW6RE5ALu85aB2WC7jtjjmYgAYmfVC19aVSvboeZ4eQitARFU2Q7okCzfFZ4GtrKFagqNpepbW4DW4HuSchwLbWUnXf6ezrR7xth8xURFZWtfHWuhZgw5aGwrEw1cvANhpdcN5NHvkQNrmKonasMjG7khGPKajafh8EXwHx2g

Public Key

4WA5vRJLthsg6sJqVc6DQuRkGzvoxZ11SkqzwbqxCo2V: 7K93R57mzck2wDTobagwc3WXEfAsnyUUYa1pVr9ejiMJJRahpSbKMX24zxG12cB383ct7XgcW9GGwzeXse8H7uedyqhNjmy7FxgzEz1b9uDppLChrswpHny4GfJRyFENGxmJx6XDxcwSKEyrbWRXH45dAyCWWNwGHDKvQTiLcdTn5MNnLXB9nGoMLYdY1PdcLETU4qhZjrufeAGxh2ApeuSUEaSADLpNoucq2gHW23stsAzPEo3PWc4Z3HGkygbbES9EkcQKrQpm7TTzX6K8WShWhe7rbpFAmqD7r8hraHwb47uFXR5bHvnW77tQ4gs2KP3V1Zxvz7LXbvVFqpT8BiFwtLpUmyZ9pp7kZVp9QZxqmegZXvpvxk3we7p857bwK7foB4ou5B2hV7vYZChZ28s79syXSUSig

@Vuk7912 Vuk7912 changed the title [WIP] Add Input Validation for Todo Item Title Implement Todo Item Title Validation Jun 28, 2025
@Vuk7912 Vuk7912 marked this pull request as ready for review June 28, 2025 16:48
Vuk7912 added a commit to Vuk7912/kotlinTodoApp that referenced this pull request Jun 28, 2025
sopheakim added a commit to sopheakim/kotlinTodoApp that referenced this pull request Jul 5, 2025
hubbahubba11x added a commit to hubbahubba11x/kotlinTodoApp that referenced this pull request Jul 5, 2025
gapcomputer2 added a commit to gapcomputer2/kotlinTodoApp that referenced this pull request Jul 5, 2025
Jockstrap6334 added a commit to Jockstrap6334/kotlinTodoApp that referenced this pull request Jul 5, 2025
Gulnozik added a commit to Gulnozik/kotlinTodoApp that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant