private void assertLabeled(AlarmRule alarmRule, String value1, String value2, String value3, int alarmMsgSize) {
        alarmRule.setAlarmRuleName("endpoint_labeled_alarm_rule");
        alarmRule.setPeriod(15);
        alarmRule.setMessage("response percentile of endpoint {name} is lower than expected value");
        alarmRule.setTags(new HashMap<String, String>() {{
            put("key", "value");
        }});
        RunningRule runningRule = new RunningRule(alarmRule, null);

        DateTime startTime = DateTime.now();
        long timeInPeriod1 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(6).getMillis());
        long timeInPeriod2 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(4).getMillis());
        long timeInPeriod3 = TimeBucket.getMinuteTimeBucket(startTime.minusMinutes(2).getMillis());

        runningRule.in(getMetaInAlarm(123, "endpoint_labeled"), getLabeledValueMetrics(timeInPeriod1, value1));
        runningRule.in(getMetaInAlarm(123, "endpoint_labeled"), getLabeledValueMetrics(timeInPeriod2, value2));

        // check at startTime - 4
        List<AlarmMessage> alarmMessages = runningRule.check();
        Assertions.assertEquals(0, alarmMessages.size());

        // check at startTime
        runningRule.moveTo(startTime.toLocalDateTime());
        runningRule.in(getMetaInAlarm(123, "endpoint_labeled"), getLabeledValueMetrics(timeInPeriod3, value3));
        alarmMessages = runningRule.check();
        Assertions.assertEquals(alarmMsgSize, alarmMessages.size());
    }
Running rule is the core of how does alarm work.
<p>
So in this test, we need to simulate a lot of scenario to see the reactions.
oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRuleTest.java