BAEL-2562 New section in Generics article
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.hasItems;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
@@ -66,4 +67,12 @@ public class GenericsUnitTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAnInt_whenAddedToAGenericIntegerList_thenAListItemCanBeAssignedToAnInt() {
|
||||
int number = 7;
|
||||
List<Integer> list = Generics.createList(number);
|
||||
int otherNumber = list.get(0);
|
||||
assertThat(otherNumber, is(number));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user