InternalGrammarDocument implements GrammarDocument { @Override public int hashCode() { final int prime = HASH_CODE_MULTIPLIER; return prime * HASH_CODE_BASE + Arrays.hashCode(buffer); } InternalGrammarDocument(final Grammar node); @Override boolean isCacheable(); @Override void setURI(final URI value); @Override URI getURI(); @Override GrammarType getMediaType(); @Override void setMediaType(final GrammarType grammartype); @Override boolean isAscii(); @Override byte[] getBuffer(); @Override String getDocument(); @Override String getTextContent(); @Override boolean equals(final Object obj); @Override boolean equals(final GrammarDocument other); @Override int hashCode(); @Override ModeType getModeType(); @Override void setModeType(final ModeType modeType); @Override String toString();  }
@Test public void testHashCodeInternal() throws Exception { final VoiceXmlDocument doc1 = new VoiceXmlDocument(); final Vxml vxml1 = doc1.getVxml(); final Form form1 = vxml1.appendChild(Form.class); final Grammar grammar1 = form1.appendChild(Grammar.class); grammar1.setVersion("1.0"); grammar1.setType(GrammarType.SRGS_XML); final Rule rule1 = grammar1.appendChild(Rule.class); final OneOf oneof1 = rule1.appendChild(OneOf.class); final Item item11 = oneof1.appendChild(Item.class); item11.addText("visa"); final Item item12 = oneof1.appendChild(Item.class); item12.addText("mastercard"); final Item item13 = oneof1.appendChild(Item.class); item13.addText("american express"); final InternalGrammarDocument document1 = new InternalGrammarDocument( grammar1); final VoiceXmlDocument doc2 = new VoiceXmlDocument(); final Vxml vxml2 = doc2.getVxml(); final Form form2 = vxml2.appendChild(Form.class); final Grammar grammar2 = form2.appendChild(Grammar.class); grammar2.setVersion("1.0"); grammar2.setType(GrammarType.SRGS_XML); final Rule rule2 = grammar2.appendChild(Rule.class); final OneOf oneof2 = rule2.appendChild(OneOf.class); final Item item21 = oneof2.appendChild(Item.class); item21.addText("visa"); final Item item22 = oneof2.appendChild(Item.class); item22.addText("mastercard"); final Item item23 = oneof2.appendChild(Item.class); item23.addText("american express"); final InternalGrammarDocument document2 = new InternalGrammarDocument( grammar2); Assert.assertEquals(document1.hashCode(), document2.hashCode()); }