package com.mesosphere.sdk.scheduler.plan;

import com.mesosphere.sdk.scheduler.plan.strategy.CanaryStrategy;
import com.mesosphere.sdk.scheduler.plan.strategy.SerialStrategy;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;

public class DefaultPhaseTest {

    @Test
    public void testGetStatus() {
        Step step1 = Mockito.mock(DeploymentStep.class);
        Step step2 = Mockito.mock(DeploymentStep.class);

        final DefaultPhase serialPhase = new DefaultPhase(
                "serial-phase",
                Arrays.asList(step1, step2),
                new SerialStrategy<>(),
                Collections.emptyList());

        when(step1.getStatus()).thenReturn(Status.PENDING);
        when(step2.getStatus()).thenReturn(Status.WAITING);
        when(step1.isEligible(any(Collection.class))).thenReturn(true);
        when(step2.isEligible(any(Collection.class))).thenReturn(true);

        Assert.assertEquals(Status.PENDING, serialPhase.getStatus());

        when(step1.getStatus()).thenReturn(Status.WAITING);
        when(step2.getStatus()).thenReturn(Status.WAITING);
        when(step1.isEligible(any(Collection.class))).thenReturn(true);
        when(step2.isEligible(any(Collection.class))).thenReturn(true);

        final DefaultPhase canaryPhase = new DefaultPhase(
                "canary-phase",
                Arrays.asList(step1, step2),
                new CanaryStrategy(new SerialStrategy<>()),
                Collections.emptyList());

        Assert.assertEquals(Status.WAITING, canaryPhase.getStatus());
    }
}

@@ -329,16 +329,39 @@
 ections;
+%0Aimport java.util.List;
 %0A%0Aimport
@@ -625,16 +625,72 @@
 .class);
+%0A        List%3CStep%3E steps = Arrays.asList(step1, step2);
 %0A%0A      
@@ -794,35 +794,13 @@
     
-Arrays.asList(step1, step2)
+steps
 ,%0A  
@@ -1592,35 +1592,13 @@
     
-Arrays.asList(step1, step2)
+steps
 ,%0A  
@@ -1652,16 +1652,23 @@
 tegy%3C%3E()
+, steps
 ),%0A     

fix compiler errors