Summary: The method `junit.framework.TestCase.setUp()` is always run before the other methods by the JUnit testing framework. So the method act as a class initializer. Reviewed By: sblackshear Differential Revision: D4487371 fbshipit-source-id: 1998801master
parent
90f4c83ef2
commit
b6fae5cd46
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
public class JunitExample extends TestCase {
|
||||||
|
|
||||||
|
private Object mField;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
mField = new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSomething() {
|
||||||
|
mField.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue