Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Help > test my equals ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 15938 of 16566
Post > Topic >>

test my equals using junit 4

by mike <mikaelpetterson@[EMAIL PROTECTED] > Apr 3, 2008 at 06:44 AM

Hi,

Is there a simple way to unit test ( using junit 4) the following
code:

@[EMAIL PROTECTED]
 boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final DistributionGroup other = (DistributionGroup) obj;
		if (address == null) {
			if (other.address != null)
				return false;
		} else if (!address.equals(other.address))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (noAnswerTimeout == null) {
			if (other.noAnswerTimeout != null)
				return false;
		} else if (!noAnswerTimeout.equals(other.noAnswerTimeout))
			return false;
		if (open != other.open)
			return false;
		if (overflowWhenBusy == null) {
			if (other.overflowWhenBusy != null)
				return false;
		} else if (!overflowWhenBusy.equals(other.overflowWhenBusy))
			return false;
		if (overflowWhenClosed == null) {
			if (other.overflowWhenClosed != null)
				return false;
		} else if (!overflowWhenClosed.equals(other.overflowWhenClosed))
			return false;
		if (overflowWhenNoAgents == null) {
			if (other.overflowWhenNoAgents != null)
				return false;
		} else if (!overflowWhenNoAgents.equals(other.overflowWhenNoAgents))
			return false;
		if (announcement != other.announcement)
			return false;
		if (sup****tAgents == null) {
			if (other.sup****tAgents != null)
				return false;
		} else if (!sup****tAgents.equals(other.sup****tAgents))
			return false;
		return true;
	}

cheers,

//mike
 




 5 Posts in Topic:
test my equals using junit 4
mike <mikaelpetterson@  2008-04-03 06:44:35 
Re: test my equals using junit 4
Eric Sosman <esosman@[  2008-04-03 10:05:45 
Re: test my equals using junit 4
Alex.From.Ohio.Java@[EMAI  2008-04-03 08:39:42 
Re: test my equals using junit 4
mike <mikaelpetterson@  2008-04-03 22:12:13 
Re: test my equals using junit 4
Eric Sosman <esosman@[  2008-04-04 09:31:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 16:23:16 CST 2008.