aboutsummaryrefslogtreecommitdiffstats
path: root/config-model-api/src/test/java/com/yahoo/config/model/api/ModelContextTest.java
blob: 5eed7af419a761682219d7aaf51f7df01c97152a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.api;

import org.junit.Test;

import java.lang.reflect.Method;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
 * @author bjorncs
 */
public class ModelContextTest {

    @Test
    public void verify_all_feature_flag_methods_have_annotation() {
        for (Method method : ModelContext.FeatureFlags.class.getDeclaredMethods()) {
            assertNotNull(
                    String.format(
                            "Method '%s' is not annotated with '%s'",
                            method.getName(), ModelContext.ModelFeatureFlag.class.getSimpleName()),
                    method.getDeclaredAnnotation(ModelContext.ModelFeatureFlag.class));
        }
    }

    @Test
    public void verify_all_feature_flag_methods_have_default_implementation() {
        for (Method method : ModelContext.FeatureFlags.class.getDeclaredMethods()) {
            assertTrue(
                    String.format("Method '%s' has no default implementation", method.getName()),
                    method.isDefault());
        }
    }

}