Skip to content

Commit

Permalink
Add test case to validate @after is called even if @before is failed.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 449848649
  • Loading branch information
gkdn authored and Copybara-Service committed May 19, 2022
1 parent 8dfd8db commit 4f4c325
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -106,7 +106,7 @@ public void testThrowsInBefore() throws Exception {
.testClassName(testName)
.addTestFailure("test")
.addTestSuccess("testOther")
.addJavaLogLineSequence("before", "before", "testOther")
.addJavaLogLineSequence("before", "after", "before", "testOther", "after")
.addBlackListedWord("should_not_be_in_log")
.build();

Expand Down
Expand Up @@ -16,6 +16,7 @@
package com.google.j2cl.junit.integration.junit4.data;

import com.google.j2cl.junit.integration.testlogger.TestCaseLogger;
import org.junit.After;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
Expand Down Expand Up @@ -44,6 +45,11 @@ public void before() {
}
}

@After
public void after() {
TestCaseLogger.log("after");
}

@Test
public void test() {
TestCaseLogger.log("should_not_be_in_log");
Expand Down

0 comments on commit 4f4c325

Please sign in to comment.