// Path: status-core/src/test/java/com/indeed/status/core/test/ControlledDependency.java
// public class ControlledDependency extends PingableDependency {
//     public static final RuntimeException EXCEPTION = new RuntimeException("BAD");
//     @Nonnull private final Supplier<Boolean> toggle;
//     private boolean inError = true;
//     private int times;
// 
//     private ControlledDependency(
//             @Nonnull final Supplier<Boolean> toggle, @Nonnull final Urgency urgency) {
//         super("controlled-id", "controlled-description", urgency);
//         this.toggle = toggle;
//     }
// 
//     public static final class TestDepControlledBuilder
//             extends PingableDependencyBuilder<ControlledDependency, TestDepControlledBuilder> {
//         private TestDepControlledBuilder() {}
// 
//         @Override
//         public ControlledDependency build() {
//             return new ControlledDependency(toggle, urgency != null ? urgency : Urgency.REQUIRED);
//         }
//     }
// 
//     public static ControlledDependency build() {
//         return new TestDepControlledBuilder().build();
//     }
// 
//     public static TestDepControlledBuilder builder() {
//         return new TestDepControlledBuilder();
//     }
// 
//     public void setInError(boolean toggle) {
//         this.inError = toggle;
//     }
// 
//     public int getTimes() {
//         return times;
//     }
// 
//     @Override
//     public void ping() throws Exception {
//         if (toggle.get()) {
//             times++;
//             if (inError) {
//                 throw EXCEPTION;
//             }
//         }
//     }
// }


import com.indeed.status.core.test.ControlledDependency;
import org.junit.Test;
import static com.indeed.status.core.CheckStatus.MAJOR;
import static com.indeed.status.core.CheckStatus.MINOR;
import static com.indeed.status.core.CheckStatus.OK;
import static com.indeed.status.core.CheckStatus.OUTAGE;
import static com.indeed.status.core.Urgency.NONE;
import static com.indeed.status.core.Urgency.REQUIRED;
import static com.indeed.status.core.Urgency.STRONG;
import static com.indeed.status.core.Urgency.WEAK;
import static org.junit.Assert.assertEquals;
        assertDowngradeStatus(REQUIRED, OUTAGE, OUTAGE);
    }

    @Test
    public void testStrong() throws Exception {
        assertDowngradeStatus(STRONG, OK, OK);
        assertDowngradeStatus(STRONG, MINOR, MINOR);
        assertDowngradeStatus(STRONG, MAJOR, MAJOR);
        assertDowngradeStatus(STRONG, OUTAGE, MAJOR);
    }

    @Test
    public void testWeak() throws Exception {
        assertDowngradeStatus(WEAK, OK, OK);
        assertDowngradeStatus(WEAK, MINOR, MINOR);
        assertDowngradeStatus(WEAK, MAJOR, MINOR);
        assertDowngradeStatus(WEAK, OUTAGE, MINOR);
    }

    @Test
    public void testNone() throws Exception {
        assertDowngradeStatus(NONE, OK, OK);
        assertDowngradeStatus(NONE, MINOR, OK);
        assertDowngradeStatus(NONE, MAJOR, OK);
        assertDowngradeStatus(NONE, OUTAGE, OK);
    }

    private void assertDowngradeStatus(
            Urgency depUrgency, CheckStatus checkStatus, CheckStatus sysStatus) {
        final CheckResultSet set = CheckResultSet.newInstance();
// Path: status-core/src/test/java/com/indeed/status/core/test/ControlledDependency.java
// public class ControlledDependency extends PingableDependency {
//     public static final RuntimeException EXCEPTION = new RuntimeException("BAD");
//     @Nonnull private final Supplier<Boolean> toggle;
//     private boolean inError = true;
//     private int times;
// 
//     private ControlledDependency(
//             @Nonnull final Supplier<Boolean> toggle, @Nonnull final Urgency urgency) {
//         super("controlled-id", "controlled-description", urgency);
//         this.toggle = toggle;
//     }
// 
//     public static final class TestDepControlledBuilder
//             extends PingableDependencyBuilder<ControlledDependency, TestDepControlledBuilder> {
//         private TestDepControlledBuilder() {}
// 
//         @Override
//         public ControlledDependency build() {
//             return new ControlledDependency(toggle, urgency != null ? urgency : Urgency.REQUIRED);
//         }
//     }
// 
//     public static ControlledDependency build() {
//         return new TestDepControlledBuilder().build();
//     }
// 
//     public static TestDepControlledBuilder builder() {
//         return new TestDepControlledBuilder();
//     }
// 
//     public void setInError(boolean toggle) {
//         this.inError = toggle;
//     }
// 
//     public int getTimes() {
//         return times;
//     }
// 
//     @Override
//     public void ping() throws Exception {
//         if (toggle.get()) {
//             times++;
//             if (inError) {
//                 throw EXCEPTION;
//             }
//         }
//     }
// }


// Path: status-core/src/test/java/com/indeed/status/core/CheckResultSetTest.java
import com.indeed.status.core.test.ControlledDependency;
import org.junit.Test;
import static com.indeed.status.core.CheckStatus.MAJOR;
import static com.indeed.status.core.CheckStatus.MINOR;
import static com.indeed.status.core.CheckStatus.OK;
import static com.indeed.status.core.CheckStatus.OUTAGE;
import static com.indeed.status.core.Urgency.NONE;
import static com.indeed.status.core.Urgency.REQUIRED;
import static com.indeed.status.core.Urgency.STRONG;
import static com.indeed.status.core.Urgency.WEAK;
import static org.junit.Assert.assertEquals;

        assertDowngradeStatus(REQUIRED, OUTAGE, OUTAGE);
    }

    @Test
    public void testStrong() throws Exception {
        assertDowngradeStatus(STRONG, OK, OK);
        assertDowngradeStatus(STRONG, MINOR, MINOR);
        assertDowngradeStatus(STRONG, MAJOR, MAJOR);
        assertDowngradeStatus(STRONG, OUTAGE, MAJOR);
    }

    @Test
    public void testWeak() throws Exception {
        assertDowngradeStatus(WEAK, OK, OK);
        assertDowngradeStatus(WEAK, MINOR, MINOR);
        assertDowngradeStatus(WEAK, MAJOR, MINOR);
        assertDowngradeStatus(WEAK, OUTAGE, MINOR);
    }

    @Test
    public void testNone() throws Exception {
        assertDowngradeStatus(NONE, OK, OK);
        assertDowngradeStatus(NONE, MINOR, OK);
        assertDowngradeStatus(NONE, MAJOR, OK);
        assertDowngradeStatus(NONE, OUTAGE, OK);
    }

    private void assertDowngradeStatus(
            Urgency depUrgency, CheckStatus checkStatus, CheckStatus sysStatus) {
        final CheckResultSet set = CheckResultSet.newInstance();
        final ControlledDependency dep =