### Question:
ResourceDescriptor { @Override public int hashCode() { int result = 0; if (type != null) { result = type.hashCode(); } if (name != null) { result = 29 * result + name.hashCode(); } else if (pattern != null) { result = 29 * result + pattern.hashCode(); } return result; } ResourceDescriptor(final Element element); String getType(); String getName(); String getLocation(); String getContent(); boolean doesTypeAndNameMatch(final String type, final String name); Map<String, String> getParameters(); String getParameter(final String key); @Override boolean equals(final Object o); @Override int hashCode(); ResourceLocation getResourceLocationForName(final String name);  }### Answer:
@Test public void testHashcode() { Element desc = DocumentHelper.createElement("foo"); desc.addAttribute("name", "foo"); desc.addAttribute("type", "bar"); assertNotNull(new ResourceDescriptor(desc).hashCode()); desc.addAttribute("type", null); assertNotNull(new ResourceDescriptor(desc).hashCode()); desc.addAttribute("name", null); desc.addAttribute("namePattern", "foo"); desc.addAttribute("location", "bar"); }