ServiceTools { public String getLiteralType(Type type) { String result = ""; if (type != null) { if (ParameterizedType.class.isAssignableFrom(type.getClass())) { ParameterizedType parameterizedType = (ParameterizedType) type; result = parameterizedType.toString(); } else { result = ((Class) type).getCanonicalName(); } } return result; }  String getShortName(String fullformat); String getLiteralType(Type type); IJsonMarshaller getJsonMarshaller(Annotation[] annotations); IJsonMarshaller getJsonMarshallerFromAnnotation(JsonUnmarshaller jua); String getTemplateOfType(Type type, IJsonMarshaller jsonMarshaller); String getInstanceNameFromDataservice(Class cls); boolean isConsiderateMethod(Method method);  }
@Test public void testGetLiteralType() { System.out.println("getLiteralType"); String result = instance.getLiteralType(String.class); assertThat(result).isEqualTo("java.lang.String"); result = instance.getLiteralType(null); assertThat(result).isEqualTo(""); }
@Test public void testGetLiteralParameterizedType() { System.out.println("getLiteralType"); String expResult = "java.lang.Collection<java.lang.Map<java.lang.String, java.lang.Collection<java.lang.Integer>>>"; ParameterizedType type = mock(ParameterizedType.class); when(type.toString()).thenReturn(expResult); String result = instance.getLiteralType(type); assertThat(result).isEqualTo(expResult); }