@@ -0,0 +1,2261 @@
+/*%0A * Copyright 2013 Google Inc. All rights reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.google.errorprone.refaster;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport com.sun.tools.javac.util.Context;%0Aimport com.sun.tools.javac.util.Context.Key;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.JUnit4;%0A%0A/**%0A * Tests for %7B@link SubContext%7D.%0A *%0A * @author lowasser@google.com (Louis Wasserman)%0A */%0A@RunWith(JUnit4.class)%0Apublic class SubContextTest %7B%0A  private static final Key%3CString%3E KEY1 = new Key%3CString%3E();%0A  private static final Key%3CString%3E KEY2 = new Key%3CString%3E();%0A  %0A  enum Enum1 %7B%0A    VALUE1, VALUE2;%0A  %7D%0A  %0A  enum Enum2 %7B%0A    VALUE;%0A  %7D%0A%0A  @Test%0A  public void testOverlay() %7B%0A    Context base = new Context();%0A    base.put(KEY1, %22key1%22);%0A    base.put(Enum1.class, Enum1.VALUE1);%0A    Context overlay = new SubContext(base);%0A    overlay.put(KEY2, %22key2%22);%0A    overlay.put(Enum2.class, Enum2.VALUE);%0A    %0A    assertEquals(%22key1%22, overlay.get(KEY1));%0A    assertEquals(Enum1.VALUE1, overlay.get(Enum1.class));%0A    assertEquals(%22key2%22, overlay.get(KEY2));%0A    assertEquals(Enum2.VALUE, overlay.get(Enum2.class));%0A    %0A    assertEquals(null, base.get(KEY2));%0A    assertEquals(null, base.get(Enum2.class));%0A  %7D%0A%0A  @Test%0A  public void testOverride() %7B%0A    Context base = new Context();%0A    base.put(KEY1, %22key1%22);%0A    base.put(Enum1.class, Enum1.VALUE1);%0A    Context overlay = new SubContext(base);%0A    overlay.put(KEY1, %22key2%22);%0A    overlay.put(Enum1.class, Enum1.VALUE2);%0A    %0A    assertEquals(%22key2%22, overlay.get(KEY1));%0A    assertEquals(Enum1.VALUE2, overlay.get(Enum1.class));%0A    assertEquals(%22key1%22, base.get(KEY1));%0A    assertEquals(Enum1.VALUE1, base.get(Enum1.class));%0A  %7D%0A%7D%0A

Move SubContextTest to third_party Refaster, and delete now-unused tests from Google-internal Refaster. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=74432442