Guest User

Untitled

a guest
Jun 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import static org.hamcrest.*;
  2. import static org.junit.Assert.assertThat;
  3. import java.util.*;
  4. import org.junit.Test;
  5.  
  6. public class TestGenerics {
  7. @Test
  8. public void thisShouldCompile() {
  9. List<String> myList = Arrays.asList("a", "b", "c");
  10. assertThat("List doesn't contain unexpected elements", myList, not(anyOf(hasItem("d"), hasItem("e"), hasItem("f"))));
  11. }
  12. }
  13.  
  14. [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>>)
  15. method org.junit.Assert.<T>assertThat(java.lang.String,T,org.hamcrest.Matcher<? super T>) is not applicable
  16. (inference variable T has incompatible bounds
  17. upper bounds: java.lang.String,java.lang.Object
  18. 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?)
  19. method org.junit.Assert.<T>assertThat(T,org.hamcrest.Matcher<? super T>) is not applicable
  20. (cannot infer type-variable(s) T
  21. (actual and formal argument lists differ in length))
Add Comment
Please, Sign In to add comment