diff options
author | 2017-02-10 16:46:12 +0000 | |
---|---|---|
committer | 2017-02-10 18:19:16 +0000 | |
commit | 6fdef7b5bd0c9cab1d768c7dda07a460aa4fe25a (patch) | |
tree | 2f213747dba73a2825402e6072b65ea51898c602 /src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/model/TestSuiteNodeTest.java | |
parent | bcff52f6ce1ceb7b263cf3b3c508fa9610d1253f (diff) |
Move the JUnit runner tests to the same location as the Internal Repo.
--
PiperOrigin-RevId: 147159416
MOS_MIGRATED_REVID=147159416
Diffstat (limited to 'src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/model/TestSuiteNodeTest.java')
-rw-r--r-- | src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/model/TestSuiteNodeTest.java | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/model/TestSuiteNodeTest.java b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/model/TestSuiteNodeTest.java new file mode 100644 index 0000000000..61b97cdd6f --- /dev/null +++ b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/model/TestSuiteNodeTest.java @@ -0,0 +1,86 @@ +// Copyright 2015 The Bazel Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.testing.junit.runner.model; + +import static org.junit.Assert.assertFalse; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.Description; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +/** + * Unit test for {@link TestSuiteNode}. + */ +@RunWith(MockitoJUnitRunner.class) +public class TestSuiteNodeTest { + + private static final long NOW = 1; + + @Mock private TestCaseNode testCaseNode; + private TestSuiteNode testSuiteNode; + + @Before + public void createTestSuiteNode() { + testSuiteNode = new TestSuiteNode(Description.createSuiteDescription("suite")); + testSuiteNode.addTestCase(testCaseNode); + } + + @Test + public void testIsTestCase() { + assertFalse(testSuiteNode.isTestCase()); + verifyZeroInteractions(testCaseNode); + } + + @Test + public void testInterrupted() { + testSuiteNode.testInterrupted(NOW); + verify(testCaseNode, times(1)).testInterrupted(NOW); + } + + @Test + public void testTestSkipped() { + testSuiteNode.testSkipped(NOW); + verify(testCaseNode, times(1)).testSkipped(NOW); + } + + @Test + public void testTestIgnored() { + testSuiteNode.testSuppressed(NOW); + verify(testCaseNode, times(1)).testSuppressed(NOW); + } + + @Test + public void testTestFailure() { + Exception failure = new Exception(); + testSuiteNode.testFailure(failure, NOW); + verify(testCaseNode, times(1)).testFailure(failure, NOW); + } + + @Test + public void testDynamicFailure() { + Description dynamicTestCaseDescription = mock(Description.class); + Exception failure = new Exception(); + testSuiteNode.dynamicTestFailure(dynamicTestCaseDescription, failure, NOW); + verify(testCaseNode, times(1)).dynamicTestFailure(dynamicTestCaseDescription, failure, NOW); + verifyZeroInteractions(dynamicTestCaseDescription); + } + +} |