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
14
15
16
17
18
19
20
21
22
23
24
25
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 }