@@ -1389,6 +1389,11 @@ public void testMessageHashcode() throws Exception {
13891389 builder .append (this .value );
13901390 };
13911391 };
1392+ StatsDTestMessage previousNewAspectString = new StatsDTestMessage <Long >(new String ("my.count" ), Message .Type .COUNT , Long .valueOf (1 ), 0 , new String [0 ]) {
1393+ @ Override protected void writeValue (StringBuilder builder ) {
1394+ builder .append (this .value );
1395+ };
1396+ };
13921397 StatsDTestMessage previousTagged =
13931398 new StatsDTestMessage <Long >("my.count" , Message .Type .COUNT , Long .valueOf (1 ), 0 , new String [] {"foo" , "bar" }) {
13941399
@@ -1412,6 +1417,23 @@ public void testMessageHashcode() throws Exception {
14121417
14131418 assertEquals (previous .hashCode (), next .hashCode ());
14141419 assertEquals (previousTagged .hashCode (), nextTagged .hashCode ());
1420+ assertEquals (previous .hashCode (), previousNewAspectString .hashCode ());
1421+ assertEquals (previous , previousNewAspectString );
1422+
1423+ class TestAlphaNumericMessage extends AlphaNumericMessage {
1424+ public TestAlphaNumericMessage (String aspect , Type type , String value , String [] tags ) {
1425+ super (aspect , type , value , tags );
1426+ }
1427+
1428+ @ Override
1429+ void writeTo (StringBuilder builder , String containerID ) {
1430+
1431+ }
1432+ }
1433+ AlphaNumericMessage alphaNum1 = new TestAlphaNumericMessage ("my.count" , Message .Type .COUNT , "value" , new String [] {"tag" });
1434+ AlphaNumericMessage alphaNum2 = new TestAlphaNumericMessage (new String ("my.count" ), Message .Type .COUNT , new String ("value" ), new String []{new String ("tag" )});
1435+ assertEquals (alphaNum1 , alphaNum2 );
1436+
14151437 }
14161438
14171439 @ Test (timeout = 5000L )
0 commit comments