Skip to content

test: add unit tests for Alarm model class #29

Description

@databufflabs

Description

Alarm (ai-apm-web/src/main/java/com/databuff/apm/web/monitor/Alarm.java) is a core model class for the alerting system that stores individual alarm instances. It currently has no unit tests, while similar model classes like EventRule (EventRuleTest.java) do have tests.

Task

Write unit tests for the Alarm class covering:

  • Field getter/setter behavior
  • Construction with different parameters (severity, status, metric name, etc.)
  • Any custom methods or validation logic in the class (if present)
  • String representation and equality if applicable

Files to change

  • New file: ai-apm-web/src/test/java/com/databuff/apm/web/monitor/AlarmTest.java

Acceptance criteria

  • Tests cover all public methods of Alarm
  • Tests include different severity and status combinations
  • Tests for any business logic methods in the class
  • All tests pass with mvn test
  • Follows existing test patterns and conventions (JUnit 5 + AssertJ)

Skill requirements

  • Java
  • JUnit 5
  • AssertJ (optional, follows existing patterns)

Resources

  • ai-apm-web/src/main/java/.../monitor/Alarm.java — the class under test
  • ai-apm-web/src/test/java/.../monitor/EventRuleTest.java — existing model test for reference patterns
  • ai-apm-web/src/test/java/.../monitor/EventRuleServiceTest.java — existing service test for reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions