mercredi 11 novembre 2020

Junit specific testing question on methods

I had an existing codebase with a few junit tests. Recently I added getshape() into the explain shape method. Now the unit tests aren't passing because get shape affects the result. How can I update the unit test to pass. Is their any way to have junit do nothing for that new method I added even though getshape is within explain shape?

//existing junit tests
Shape shape = new Shape();

//existing test
testShapeMatch(){
shape.updateShape()

assert(2, shape.size())
}

//Actual code (simplified)
updateShape{
    explainshape()
}

explainshape(){
    //do something
    getShape();
    //do something else
}

getShape(){
    //do something
}

Aucun commentaire:

Enregistrer un commentaire