vendredi 1 avril 2016

Teardown() in Junit Testing

Trying to do some JUnit testing, but it's been a while so I forget some stuff. If i'm testing a class, i make an object of the class in the @before() but then in the teardown am i not supposed to make it null? that way it erases any problems or anything that could interfere with my next test?

so far i've done this.

package potluck.Testing;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import potluck.domain.Controller;
/**
 * @author Samuel
 *
 */
  public class ControllerTest {

  /**
  * @throws java.lang.Exception
  */
@Before
public void setUp() throws Exception {

    Controller testCntlr = Controller.getInstance();
}

/**
 * @throws java.lang.Exception
 */
@After
public void tearDown() throws Exception {
testCntlr() = null;
}


}

but it says it can't be resolved to a variable.

Aucun commentaire:

Enregistrer un commentaire