Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static enum Test{
- TEST1, TEST2;
- }
- private class<T> TestClass{
- Map<T, String> map = new HashMap<T, String>();
- public void add(T obj, String name){
- map.put(obj, name);
- }
- public String get(T obj){
- return map.get(obj);
- }
- }
- // Somewhere... such as a unit test
- TestClass<Test> test = new TestClass<Test>();
- assertNull(test.get(Test.TEST1));
- test.add(Test.TEST1, "somename");
- assertNotNull(test.get(Test.TEST1)); // FAILS TO ASSERT
Advertisement
Add Comment
Please, Sign In to add comment