### Question:
Methods { static Type resolveType(Type type, TypeToken<?> daoTypeToken) { return genericTypeToken.isAssignableFrom(daoTypeToken) ? daoTypeToken.resolveType(type).getType() : type; }  static MethodDescriptor getMethodDescriptor(Class<?> daoClass, Method method, boolean isUseActualParamName); static List<Method> listMethods(Class<?> clazz);  }### Answer:
@Test public void testResolveType() throws Exception { TypeToken<?> daoTypeToken = TypeToken.of(SubDao.class); Method m = SubDao.class.getMethod("add", Object.class); Type type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(type, equalTo((Type) void.class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((Type) String.class)); m = SubDao.class.getMethod("add", Collection.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(TypeToken.of(type).getRawType(), equalTo((Type) int[].class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((new TypeToken<Collection<String>>(){}.getType()))); m = SubDao.class.getMethod("findOne", Object.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(type, equalTo((Type) String.class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((Type) Integer.class)); m = SubDao.class.getMethod("findAll", List.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(type, equalTo((new TypeToken<List<String>>(){}.getType()))); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((new TypeToken<List<Integer>>(){}.getType()))); m = SubDao.class.getMethod("update", Object.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(type, equalTo((Type) int.class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((Type) String.class)); m = SubDao.class.getMethod("update", Collection.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(TypeToken.of(type).getRawType(), equalTo((Type) int[].class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((new TypeToken<Collection<String>>(){}.getType()))); m = SubDao.class.getMethod("delete", Object.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(type, equalTo((Type) int.class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((Type) Integer.class)); m = SubDao.class.getMethod("getDate", List.class); type = Methods.fixAndResolveType(m.getGenericReturnType(), daoTypeToken); assertThat(type, equalTo((Type) Date.class)); type = Methods.fixAndResolveType(m.getGenericParameterTypes()[0], daoTypeToken); assertThat(type, equalTo((new TypeToken<List<String>>(){}.getType()))); }