public void testEquals() throws Exception { CharTermAttributeImpl t1a = new CharTermAttributeImpl(); char[] content1a = "hello".toCharArray(); t1a.copyBuffer(content1a, 0, 5); CharTermAttributeImpl t1b = new CharTermAttributeImpl(); char[] content1b = "hello".toCharArray(); t1b.copyBuffer(content1b, 0, 5); CharTermAttributeImpl t2 = new CharTermAttributeImpl(); char[] content2 = "hello2".toCharArray(); t2.copyBuffer(content2, 0, 6); assertTrue(t1a.equals(t1b)); assertFalse(t1a.equals(t2)); assertFalse(t2.equals(t1b)); }