Results 1 to 7 of 7
Thread: Testing arguments
- 10-10-2010, 08:34 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
Testing arguments
How would I test in a method with two formal parameters : one a previous defined array of integers and the other an int in which the method returns true if the second argument is contained within the first array argument and returns false otherwise. Honestly, I don't quite understand what i am testing so if you can just give me an idea of what I need to be doing that would help.
- 10-10-2010, 08:41 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
- 10-10-2010, 09:06 AM #3
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
thanks...quick question also.....i keep on getting a type mismatch error in this method...why? i also get dead code for i++
public static boolean contains(int[] A, int int1){
for (int i = 0; int , A.length; i++) {
if (int1 == A[i])
return true;
}
else {return false;}
}
}
- 10-10-2010, 09:07 AM #4
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
sorry made a small error before in typing code.
public static boolean contains(int[] A, int int1){
for (int i = 0; int ,i < A.length; i++) {
if (int1 == A[i])
return true;
}
else {return false;}
}
}
- 10-10-2010, 09:07 AM #5
Member
- Join Date
- Oct 2010
- Posts
- 6
- Rep Power
- 0
ignore the extra int put in there please
- 10-10-2010, 09:58 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
- 10-10-2010, 11:17 AM #7
Senior Member
- Join Date
- Oct 2010
- Posts
- 317
- Rep Power
- 3
Similar Threads
-
Sorting objects with 2 strings arguments and 2 int arguments
By tirwit in forum New To JavaReplies: 8Last Post: 09-23-2010, 12:07 AM -
JUnit testing
By hedonist in forum Advanced JavaReplies: 4Last Post: 10-04-2009, 12:06 PM -
XML to JSP Unit Testing
By Abder-Rahman in forum Advanced JavaReplies: 2Last Post: 02-15-2009, 12:35 AM -
Testing JUnit PDE with Ant
By keynan in forum EclipseReplies: 0Last Post: 02-14-2008, 11:35 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks