/*
 * Copyright 2011 Henry Coles
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, 
 * software distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and limitations under the License. 
 */
package org.pitest.mutationtest.engine.gregor.config;

import static org.assertj.core.api.Assertions.assertThat;

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

import org.junit.Test;
import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory;
import org.pitest.mutationtest.engine.gregor.mutators.InvertNegsMutator;
import org.pitest.mutationtest.engine.gregor.mutators.MathMutator;

public class MutatorTest {

  @SuppressWarnings("unchecked")
  @Test
  public void shouldReturnRequestedMutators() {
    assertThat(parseStrings("MATH", "INVERT_NEGS").containsAll(
        Arrays.asList(MathMutator.MATH_MUTATOR,
            InvertNegsMutator.INVERT_NEGS_MUTATOR)));
  }

  @Test
  public void shouldNotCreateDuplicatesWhenRequestedDirectly() {
    assertThat(parseStrings("MATH", "MATH")).hasSize(1);
  }

  @Test
  public void shouldNotCreateDuplicatesWhenRequestedViaGroup() {
    assertThat(parseStrings("MATH", "DEFAULTS")).hasSameSizeAs(
        parseStrings("DEFAULTS"));
  }
  
  private Collection<MethodMutatorFactory> parseStrings(final String... s) {
    return Mutator.fromStrings(Arrays.asList(s));
  }

}

@@ -990,16 +990,128 @@
 Mutator;
+%0Aimport org.pitest.mutationtest.engine.gregor.mutators.ReplaceMethodWithParameterOfSameTypeAsReturnValueMutator;
 %0A%0Apublic
@@ -1838,10 +1838,263 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void allContainsReplaceMethodMutator() throws Exception %7B%0A    assertThat(Mutator.all()).contains(%0A        ReplaceMethodWithParameterOfSameTypeAsReturnValueMutator.REPLACE_METHOD_WITH_PARAMETER_OF_SAME_TYPE_AS_RETURN_VALUE_MUTATOR);%0A  %7D%0A
 %7D%0A

test that mutator is listed