List<String> list = mock(List<String>.class);
here is a invalid syntax,how to pass a List<String> type to mock()?
Short answer is you can't. At runtime it's just List.class due to type erasure. If your mocking framework needs to know the type parameter there must be a different way to pass it in.
LinkedList. It uses just LinkedList.class without any type parameter.
List<whatever>) only differ at compile time, and in run time it's justList, due to type erasure? So, what you need is syntacticallyList.class; no idea how do you pass the parametrization information to yourmock.