Results 1 to 1 of 1
  1. #1
    mackavelirip is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default Junit testing, testing list<e> interface

    Hi im writing a tester that tests 13 methods from the list interface. Im having trouble with my assertEquals and assertTrue. Every single one of my assertEquals and assertTrues says there is an error. The error says "The method assertTrue(boolean) is undefined for the type List12Tester" or "The method assertEquals(Integer, Integer) is undefined for the type List12Tester" Here is an example of one of my tester methods.

    Java Code:
    public class List12Tester extends junit.framework.TestCase
        //contain test that checks if the element is in the list. **boolean add(E e)**
    	public void testAddContains()
    		List12<String> l = new List12<String>();
    Thats one example but it does it for all my tester methods. The assignment is to write the tester first then List12 so it said to make a List12 class that extends java.util.LinkedList<E>.

    Another question I had was is it legal to do something like this.

    Java Code:
    //checks if index is in bounds **add(int index, E element)**
    	public void testAddIndexInBounds()
    		List12<String> l = new List12<String>();
    		assertTrue(l.indexOf("A") >= 0);
    		assertTrue(l.indexOf("D") <= l.size());
    Is it legal to do the assertTrue with >= or <=?

    Any help would be appriciated thanks.
    Last edited by mackavelirip; 10-05-2011 at 07:11 AM.

Similar Threads

  1. J2ee developer with junit testing
    By mistybws in forum Jobs Offered
    Replies: 0
    Last Post: 10-08-2010, 11:21 PM
  2. JUNIT testing assertEquals function
    By Drun in forum New To Java
    Replies: 7
    Last Post: 01-22-2010, 07:08 PM
  3. JUnit testing
    By hedonist in forum Advanced Java
    Replies: 4
    Last Post: 10-04-2009, 01:06 PM
  4. Testing tools (Profiling and JUnit)
    By ericpinet in forum Eclipse
    Replies: 1
    Last Post: 04-21-2009, 11:23 PM
  5. Testing JUnit PDE with Ant
    By keynan in forum Eclipse
    Replies: 0
    Last Post: 02-15-2008, 12:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts