package org.modelmapper.internal;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;

import org.modelmapper.config.Configuration.AccessLevel;
import org.testng.annotations.Test;

/**
 * @author Jonathan Halterman
 */
@Test
public class InheritingConfigurationTest {
  public void testHashCode() {
    InheritingConfiguration config1 = new InheritingConfiguration();
    InheritingConfiguration config2 = new InheritingConfiguration();

    assertEquals(config1.hashCode(), config2.hashCode());
    config1.enableFieldMatching(true);
    assertFalse(config1.hashCode() == config2.hashCode());
    config2.enableFieldMatching(true);
    assertEquals(config1.hashCode(), config2.hashCode());
    config2.setMethodAccessLevel(AccessLevel.PRIVATE);
    assertFalse(config1.hashCode() == config2.hashCode());
  }

  // public void shouldMergeInheritedConfiguration() {
  // ModelMapper modelMapper = new ModelMapper();
  // MatchingConfiguration modelMapperConfig = modelMapper.getConfiguration();
  // MatchingConfiguration personMapConfig = modelMapper.getTypeMap(Object.class, String.class)
  // .getConfiguration();
  //
  // modelMapperConfig.setFieldAccessLevel(AccessLevel.Private);
  // assertEquals(modelMapperConfig.getFieldAccessLevel(), personMapConfig.getFieldAccessLevel());
  //
  // personMapConfig.setFieldAccessLevel(AccessLevel.Public);
  // assertFalse(modelMapperConfig.getFieldAccessLevel().equals(
  // personMapConfig.getFieldAccessLevel()));
  // }

  public void testEquals() {
    InheritingConfiguration config1 = new InheritingConfiguration();
    InheritingConfiguration config2 = new InheritingConfiguration();

    assertEquals(config1, config2);
    config1.enableFieldMatching(true);
    assertFalse(config1.equals(config2));
    config2.enableFieldMatching(true);
    assertEquals(config1, config2);
    config2.setMethodAccessLevel(AccessLevel.PRIVATE);
    assertFalse(config1.equals(config2));
  }
}

@@ -122,16 +122,61 @@
 tFalse;%0D
+%0Aimport static org.testng.Assert.assertTrue;%0D
 %0A%0D%0Aimpor
@@ -2062,11 +2062,554 @@
 ;%0D%0A  %7D%0D%0A
+  %0D%0A  public void testFullMatchingRequiredDefualtsToFalse() %7B%0D%0A%09  InheritingConfiguration config = new InheritingConfiguration();%0D%0A%09  assertFalse(config.isFullTypeMatchingRequired());%0D%0A  %7D%0D%0A  %0D%0A  public void testFullMatchingRequiredIsInherited() %7B%0D%0A%09  InheritingConfiguration originConfig = new InheritingConfiguration();%0D%0A%09  originConfig.setFullTypeMatchingRequired(true);%0D%0A%09  InheritingConfiguration inheritingConfig = new InheritingConfiguration(originConfig, true);%0D%0A%09  assertTrue(inheritingConfig.isFullTypeMatchingRequired());%0D%0A  %7D%0D%0A  %0D%0A
 %7D%0D%0A

Add tests for fullTypeMatching configuration.