Skip to content

Commit 85f6bcd

Browse files
Add beforeClass and AfterClass stuff.
1 parent 161c101 commit 85f6bcd

File tree

1 file changed

+22
-0
lines changed
  • AndroidListenerExamples/src/androidTest/java/com/designatednerd/androidlistenerexamples/test

1 file changed

+22
-0
lines changed

AndroidListenerExamples/src/androidTest/java/com/designatednerd/androidlistenerexamples/test/JUnit4TestExample.java

+22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package com.designatednerd.androidlistenerexamples.test;
22

3+
import android.util.Log;
4+
35
import com.designatednerd.androidlistenerexamples.model.CommonLetterFinder;
46

57
import org.junit.After;
8+
import org.junit.AfterClass;
69
import org.junit.Before;
10+
import org.junit.BeforeClass;
711
import org.junit.Ignore;
812
import org.junit.Test;
913

@@ -16,22 +20,40 @@
1620
*/
1721
public class JUnit4TestExample {
1822

23+
/*************
24+
* VARIABLES *
25+
*************/
26+
27+
private static final String LOG_TAG = "JUnit4TestExample";
28+
1929
private CommonLetterFinder mFinder;
2030

2131
/******************
2232
* TEST LIFECYCLE *
2333
******************/
2434

35+
@BeforeClass
36+
public static void beforeClass() {
37+
Log.d(LOG_TAG, "Before any of the tests in the class begin!");
38+
}
39+
2540
@Before
2641
public void beforeInstance() {
42+
Log.d(LOG_TAG, "Before each test in the class begins!");
2743
mFinder = new CommonLetterFinder();
2844
}
2945

3046
@After
3147
public void afterInstance() {
48+
Log.d(LOG_TAG, "After each test in the class ends!");
3249
mFinder = null;
3350
}
3451

52+
@AfterClass
53+
public static void afterClass() {
54+
Log.d(LOG_TAG, "After all the tests in the class end!");
55+
}
56+
3557
/*********
3658
* TESTS *
3759
*********/

0 commit comments

Comments
 (0)