@Test public void testNotEqualsDiffType() { AbstractMessage msg0; AbstractMessage msg1; msg0 = new AbstractMessage( 5, MessageTypeEnum.BIND_REQUEST ) { }; msg1 = new AbstractMessage( 5, MessageTypeEnum.UNBIND_REQUEST ) { }; assertFalse( msg0.equals( msg1 ) ); assertFalse( msg1.equals( msg0 ) ); }
@Override public boolean equals( Object obj ) { if ( obj == this ) { return true; } if ( !( obj instanceof Message ) ) { return false; } Message msg = ( Message ) obj; if ( msg.getMessageId() != id ) { return false; } if ( msg.getType() != type ) { return false; } Map<String, Control> controlMap = msg.getControls(); if ( controlMap.size() != controls.size() ) { return false; } for ( String key : controls.keySet() ) { if ( !controlMap.containsKey( key ) ) { return false; } } return true; }
AbstractMessage implements Message { @Override public boolean equals( Object obj ) { if ( obj == this ) { return true; } if ( !( obj instanceof Message ) ) { return false; } Message msg = ( Message ) obj; if ( msg.getMessageId() != id ) { return false; } if ( msg.getType() != type ) { return false; } Map<String, Control> controlMap = msg.getControls(); if ( controlMap.size() != controls.size() ) { return false; } for ( String key : controls.keySet() ) { if ( !controlMap.containsKey( key ) ) { return false; } } return true; } }
AbstractMessage implements Message { @Override public boolean equals( Object obj ) { if ( obj == this ) { return true; } if ( !( obj instanceof Message ) ) { return false; } Message msg = ( Message ) obj; if ( msg.getMessageId() != id ) { return false; } if ( msg.getType() != type ) { return false; } Map<String, Control> controlMap = msg.getControls(); if ( controlMap.size() != controls.size() ) { return false; } for ( String key : controls.keySet() ) { if ( !controlMap.containsKey( key ) ) { return false; } } return true; } protected  AbstractMessage( final int id, final MessageTypeEnum type ); }
AbstractMessage implements Message { @Override public boolean equals( Object obj ) { if ( obj == this ) { return true; } if ( !( obj instanceof Message ) ) { return false; } Message msg = ( Message ) obj; if ( msg.getMessageId() != id ) { return false; } if ( msg.getType() != type ) { return false; } Map<String, Control> controlMap = msg.getControls(); if ( controlMap.size() != controls.size() ) { return false; } for ( String key : controls.keySet() ) { if ( !controlMap.containsKey( key ) ) { return false; } } return true; } protected  AbstractMessage( final int id, final MessageTypeEnum type ); @Override int getMessageId(); @Override Message setMessageId( int id ); @Override Map<String, Control> getControls(); @Override Control getControl( String oid ); @Override boolean hasControl( String oid ); @Override Message addControl( Control control ); @Override Message removeControl( Control control ); @Override MessageTypeEnum getType(); @Override Object get( Object key ); @Override Object put( Object key, Object value ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Message addAllControls( Control[] controls ); String toString( String message ); }
AbstractMessage implements Message { @Override public boolean equals( Object obj ) { if ( obj == this ) { return true; } if ( !( obj instanceof Message ) ) { return false; } Message msg = ( Message ) obj; if ( msg.getMessageId() != id ) { return false; } if ( msg.getType() != type ) { return false; } Map<String, Control> controlMap = msg.getControls(); if ( controlMap.size() != controls.size() ) { return false; } for ( String key : controls.keySet() ) { if ( !controlMap.containsKey( key ) ) { return false; } } return true; } protected  AbstractMessage( final int id, final MessageTypeEnum type ); @Override int getMessageId(); @Override Message setMessageId( int id ); @Override Map<String, Control> getControls(); @Override Control getControl( String oid ); @Override boolean hasControl( String oid ); @Override Message addControl( Control control ); @Override Message removeControl( Control control ); @Override MessageTypeEnum getType(); @Override Object get( Object key ); @Override Object put( Object key, Object value ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Message addAllControls( Control[] controls ); String toString( String message );  }