1   package com.lexicalscope.fluentreflection.endtoend;
2   
3   import static com.lexicalscope.fluentreflection.FluentReflection.type;
4   import static com.lexicalscope.fluentreflection.ReflectionMatchers.reflectingOn;
5   import static org.hamcrest.MatcherAssert.assertThat;
6   import static org.hamcrest.Matchers.*;
7   
8   import java.util.List;
9   
10  import org.junit.Test;
11  
12  /*
13   * Copyright 2011 Tim Wood
14   *
15   * Licensed under the Apache License, Version 2.0 (the "License");
16   * you may not use this file except in compliance with the License.
17   * You may obtain a copy of the License at
18   *
19   * http://www.apache.org/licenses/LICENSE-2.0
20   *
21   * Unless required by applicable law or agreed to in writing, software
22   * distributed under the License is distributed on an "AS IS" BASIS,
23   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24   * See the License for the specific language governing permissions and
25   * limitations under the License. 
26   */
27  
28  public class TestReflectedClass {
29      @Test public void hashCodeWorks()
30      {
31          assertThat(type(String.class).hashCode(), equalTo(type(String.class).hashCode()));
32      }
33  
34      @Test public void equalsWorks()
35      {
36          assertThat(type(String.class), equalTo(type(String.class)));
37          assertThat(type(String.class), not(equalTo(null)));
38      }
39  
40      @Test public void canGetReflectedClassAsASuperType()
41      {
42          assertThat(
43                  type(List.class).asType(reflectingOn(Iterable.class)).classUnderReflection(),
44                  equalTo((Object) Iterable.class));
45      }
46  }