// Path: src/main/java/com/indeed/proctor/webapp/db/Environment.java
// public enum Environment {
//     WORKING("trunk", 0),
//     QA("qa", 1),
//     PRODUCTION("production", 2);
// 
//     private final String name;
//     private final int precedence;
//     private Environment(final String name, final int precedence) {
//         this.name = name;
//         this.precedence = precedence;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public int getPrecedence() {
//         return precedence;
//     }
// 
//     private static final Map<String, Environment> LOOKUP = Maps.uniqueIndex(ImmutableList.copyOf(Environment.values()), Functions.toStringFunction());
//     public static Environment fromName(String name) {
//         if(name == null) {
//             return null;
//         } else {
//             return LOOKUP.get(name.toLowerCase());
//         }
//     }
// 
//     @Override
//     public String toString() {
//         return this.getName();
//     }
// }
// 
// Path: src/main/java/com/indeed/proctor/webapp/model/AppVersion.java
// public class AppVersion implements Comparable<AppVersion> {
//     private final String app;
//     private final String version;
// 
//     public AppVersion(final String app,
//                       final String version) {
//         this.app = app;
//         this.version = version;
//     }
// 
//     @Override
//     public boolean equals(final Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (o == null || getClass() != o.getClass()) {
//             return false;
//         }
// 
//         final AppVersion that = (AppVersion) o;
// 
//         if (!app.equals(that.app)) {
//             return false;
//         }
//         if (!version.equals(that.version)) {
//             return false;
//         }
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = app.hashCode();
//         result = 31 * result + version.hashCode();
//         return result;
//     }
// 
//     @Override
//     public int compareTo(AppVersion that) {
//         if (this == that) {
//             return 0;
//         }
//         return ComparisonChain.start()
//                 .compare(app, that.app)
//                 .compare(version, that.version)
//                 .result();
//     }
// 
//     public String getApp() {
//         return app;
//     }
// 
//     public String getVersion() {
//         return version;
//     }
// 
//     @Override
//     public String toString() {
//         return app + '@' + version;
//     }
// 
//     public String toShortString() {
//         final String shortVersionName = version.length() > 7 ? version.substring(0, 7) : version;
//         return app + '@' + shortVersionName;
//     }
// }


import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.indeed.proctor.common.PayloadSpecification;
import com.indeed.proctor.common.ProctorUtils;
import com.indeed.proctor.common.TestSpecification;
import com.indeed.proctor.common.model.Allocation;
import com.indeed.proctor.common.model.Audit;
import com.indeed.proctor.common.model.ConsumableTestDefinition;
import com.indeed.proctor.common.model.Payload;
import com.indeed.proctor.common.model.Range;
import com.indeed.proctor.common.model.TestBucket;
import com.indeed.proctor.common.model.TestDefinition;
import com.indeed.proctor.common.model.TestMatrixArtifact;
import com.indeed.proctor.common.model.TestType;
import com.indeed.proctor.webapp.db.Environment;
import com.indeed.proctor.webapp.model.AppVersion;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import java.util.Collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
                                )
                        ),
                        false,
                        Collections.emptyMap(),
                        Collections.emptyMap(),
                        "test for a unit test"
                )
        );

        artifact.setTests(ImmutableMap.of(TEST_NAME, testDefinition));

        return artifact;
    }

    @Test
    public void testCompatibleSpecificationResultFromRequiredTest() {
        final TestSpecification testSpecification = new TestSpecification();
        testSpecification.setFallbackValue(-1);
        final PayloadSpecification payloadSpecification = new PayloadSpecification();
        payloadSpecification.setType("longValue");
        testSpecification.setPayload(payloadSpecification);
        testSpecification.setBuckets(
                ImmutableMap.of(
                        "inactive", -1,
                        "control", 0
                )
        );
        final AppVersion appVersion = new AppVersion("sample application", "v1");
        final ProctorController.CompatibleSpecificationResult result =
                ProctorController.CompatibleSpecificationResult.fromRequiredTest(
// Path: src/main/java/com/indeed/proctor/webapp/db/Environment.java
// public enum Environment {
//     WORKING("trunk", 0),
//     QA("qa", 1),
//     PRODUCTION("production", 2);
// 
//     private final String name;
//     private final int precedence;
//     private Environment(final String name, final int precedence) {
//         this.name = name;
//         this.precedence = precedence;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public int getPrecedence() {
//         return precedence;
//     }
// 
//     private static final Map<String, Environment> LOOKUP = Maps.uniqueIndex(ImmutableList.copyOf(Environment.values()), Functions.toStringFunction());
//     public static Environment fromName(String name) {
//         if(name == null) {
//             return null;
//         } else {
//             return LOOKUP.get(name.toLowerCase());
//         }
//     }
// 
//     @Override
//     public String toString() {
//         return this.getName();
//     }
// }
// 
// Path: src/main/java/com/indeed/proctor/webapp/model/AppVersion.java
// public class AppVersion implements Comparable<AppVersion> {
//     private final String app;
//     private final String version;
// 
//     public AppVersion(final String app,
//                       final String version) {
//         this.app = app;
//         this.version = version;
//     }
// 
//     @Override
//     public boolean equals(final Object o) {
//         if (this == o) {
//             return true;
//         }
//         if (o == null || getClass() != o.getClass()) {
//             return false;
//         }
// 
//         final AppVersion that = (AppVersion) o;
// 
//         if (!app.equals(that.app)) {
//             return false;
//         }
//         if (!version.equals(that.version)) {
//             return false;
//         }
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = app.hashCode();
//         result = 31 * result + version.hashCode();
//         return result;
//     }
// 
//     @Override
//     public int compareTo(AppVersion that) {
//         if (this == that) {
//             return 0;
//         }
//         return ComparisonChain.start()
//                 .compare(app, that.app)
//                 .compare(version, that.version)
//                 .result();
//     }
// 
//     public String getApp() {
//         return app;
//     }
// 
//     public String getVersion() {
//         return version;
//     }
// 
//     @Override
//     public String toString() {
//         return app + '@' + version;
//     }
// 
//     public String toShortString() {
//         final String shortVersionName = version.length() > 7 ? version.substring(0, 7) : version;
//         return app + '@' + shortVersionName;
//     }
// }


// Path: src/test/java/com/indeed/proctor/webapp/controllers/TestProctorController.java
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.indeed.proctor.common.PayloadSpecification;
import com.indeed.proctor.common.ProctorUtils;
import com.indeed.proctor.common.TestSpecification;
import com.indeed.proctor.common.model.Allocation;
import com.indeed.proctor.common.model.Audit;
import com.indeed.proctor.common.model.ConsumableTestDefinition;
import com.indeed.proctor.common.model.Payload;
import com.indeed.proctor.common.model.Range;
import com.indeed.proctor.common.model.TestBucket;
import com.indeed.proctor.common.model.TestDefinition;
import com.indeed.proctor.common.model.TestMatrixArtifact;
import com.indeed.proctor.common.model.TestType;
import com.indeed.proctor.webapp.db.Environment;
import com.indeed.proctor.webapp.model.AppVersion;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import java.util.Collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

                                )
                        ),
                        false,
                        Collections.emptyMap(),
                        Collections.emptyMap(),
                        "test for a unit test"
                )
        );

        artifact.setTests(ImmutableMap.of(TEST_NAME, testDefinition));

        return artifact;
    }

    @Test
    public void testCompatibleSpecificationResultFromRequiredTest() {
        final TestSpecification testSpecification = new TestSpecification();
        testSpecification.setFallbackValue(-1);
        final PayloadSpecification payloadSpecification = new PayloadSpecification();
        payloadSpecification.setType("longValue");
        testSpecification.setPayload(payloadSpecification);
        testSpecification.setBuckets(
                ImmutableMap.of(
                        "inactive", -1,
                        "control", 0
                )
        );
        final AppVersion appVersion = new AppVersion("sample application", "v1");
        final ProctorController.CompatibleSpecificationResult result =
                ProctorController.CompatibleSpecificationResult.fromRequiredTest(
                        Environment.PRODUCTION,