Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import static org.hamcrest.*;
- import static org.junit.Assert.assertThat;
- import java.util.*;
- import org.junit.Test;
- public class TestGenerics {
- @Test
- public void thisShouldCompile() {
- List<String> myList = Arrays.asList("a", "b", "c");
- assertThat("List doesn't contain unexpected elements", myList, not(anyOf(hasItem("d"), hasItem("e"), hasItem("f"))));
- }
- }
- [ERROR] /tmp/jdk-issue-generics/src/test/java/org/alostale/issues/generics/TestGenerics.java:[17,17] no suitable method found for assertThat(java.lang.String,java.util.List<java.lang.String>,org.hamcrest.Matcher<java.lang.Iterable<? super java.lang.Object>>)
- method org.junit.Assert.<T>assertThat(java.lang.String,T,org.hamcrest.Matcher<? super T>) is not applicable
- (inference variable T has incompatible bounds
- upper bounds: java.lang.String,java.lang.Object
- lower bounds: capture#1 of ? super T?,capture#2 of ? super java.lang.Object,capture#3 of ? super java.lang.Object,java.lang.Object,java.lang.String,capture#4 of ? super T?)
- method org.junit.Assert.<T>assertThat(T,org.hamcrest.Matcher<? super T>) is not applicable
- (cannot infer type-variable(s) T
- (actual and formal argument lists differ in length))
Add Comment
Please, Sign In to add comment