@Test
public void testHandleUnknownType() throws Exception {

	LiferayObjectWrapper liferayObjectWrapper = new LiferayObjectWrapper();
	// 1. Handle Enumeration
	Enumeration<String> enumeration = Collections.enumeration(
		Collections.singletonList("testElement"));
	assertTemplateModel(
		"testElement", enumerationModel -> enumerationModel.next(),
		EnumerationModel.class.cast(
			liferayObjectWrapper.handleUnknownType(enumeration)));
	_assertModelFactoryCache(
		"_ENUMERATION_MODEL_FACTORY", enumeration.getClass());
	// 2. Handle Node
	Node node = (Node)ProxyUtil.newProxyInstance(
		LiferayObjectWrapper.class.getClassLoader(),
		new Class<?>[] {Node.class, Element.class},
		(proxy, method, args) -> {
			String methodName = method.getName();
			if (methodName.equals("getNodeType")) {
				return Node.ELEMENT_NODE;
			}
			return null;
		});
	TemplateModel templateModel = liferayObjectWrapper.handleUnknownType(
		node);
	Assert.assertTrue(
		"org.w3c.dom.Node should be handled as NodeModel",
		templateModel instanceof NodeModel);
	NodeModel nodeModel = (NodeModel)templateModel;
	Assert.assertSame(node, nodeModel.getNode());
	Assert.assertEquals("element", nodeModel.getNodeType());
	_assertModelFactoryCache("_NODE_MODEL_FACTORY", node.getClass());
	// 3. Handle ResourceBundle
	ResourceBundle resourceBundle = new ResourceBundle() {
		@Override
		public Enumeration<String> getKeys() {
			return null;
		}
		@Override
		protected Object handleGetObject(String key) {
			return key;
		}
	};
	assertTemplateModel(
		resourceBundle.toString(),
		resourceBundleModel -> resourceBundleModel.getBundle(),
		ResourceBundleModel.class.cast(
			liferayObjectWrapper.handleUnknownType(resourceBundle)));
	_assertModelFactoryCache(
		"_RESOURCE_BUNDLE_MODEL_FACTORY", resourceBundle.getClass());
	// 4. Handle Version
	assertTemplateModel(
		"1.0", stringModel -> stringModel.getAsString(),
		StringModel.class.cast(
			liferayObjectWrapper.handleUnknownType(
				liferayObjectWrapper.handleUnknownType(
					new Version("1.0")))));
	_assertModelFactoryCache("_STRING_MODEL_FACTORY", Version.class);
}