reset password
Author Message
Rochester123
Posts: 5
Posted 21:18 Jan 26, 2014 |

Says cannot find method getArea in the test class. The method name was the same in the orginal. Why hasn't it gone through?

rabbott
Posts: 1649
Posted 21:22 Jan 26, 2014 |

You'll have to provide more information. Copy the relevant parts of the classes into the post and be a bit clearer about the error message.  What says it cannot find getArea? When/where does that message appear? Which characters/lines are highlighted when the message appears?

Last edited by rabbott at 21:25 Jan 26, 2014.
Rochester123
Posts: 5
Posted 21:36 Jan 26, 2014 |

From the Rectanglelength class and Rectanglelength test

public class Rectanglelength....

    public int getArea() {

        return  length* width;

    }

    @Test

    public void testArea() {

        Rectangle r1 = new Rectangle(0, 0, 6, 5); // set up the width and height as initial state of r1 using constructor

        assertEquals( 30, r1.getArea() );

It mentions it on the line where it says assertEquals with .getArea()

rabbott
Posts: 1649
Posted 21:49 Jan 26, 2014 |

You defined a Rectanglelength class, and defined getArea() for instances of that class, but you declared r1 to be an instance of the class Rectangle