|
| 1 | +// Copyright 2018 The Bazel Authors. All rights reserved. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package com.google.devtools.build.lib.actions; |
| 16 | + |
| 17 | +import static com.google.common.truth.Truth.assertThat; |
| 18 | + |
| 19 | +import com.google.devtools.build.lib.actions.util.ActionsTestUtil; |
| 20 | +import com.google.devtools.build.lib.actions.util.TestAction.DummyAction; |
| 21 | +import com.google.devtools.build.lib.server.FailureDetails.Execution; |
| 22 | +import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; |
| 23 | +import com.google.devtools.build.lib.util.DetailedExitCode; |
| 24 | +import org.junit.Test; |
| 25 | +import org.junit.runner.RunWith; |
| 26 | +import org.junit.runners.JUnit4; |
| 27 | + |
| 28 | +/** {@link ActionExecutionException}Test */ |
| 29 | +@RunWith(JUnit4.class) |
| 30 | +public final class ActionExecutionExceptionTest { |
| 31 | + |
| 32 | + @Test |
| 33 | + public void containsCauseMessage() { |
| 34 | + Exception e = |
| 35 | + new ActionExecutionException( |
| 36 | + "message", |
| 37 | + new Exception("cause"), |
| 38 | + new DummyAction(ActionsTestUtil.DUMMY_ARTIFACT, ActionsTestUtil.DUMMY_ARTIFACT), |
| 39 | + false, |
| 40 | + DetailedExitCode.of( |
| 41 | + FailureDetail.newBuilder().setExecution(Execution.getDefaultInstance()).build())); |
| 42 | + assertThat(e).hasMessageThat().contains("message"); |
| 43 | + assertThat(e).hasMessageThat().contains("cause"); |
| 44 | + } |
| 45 | +} |
0 commit comments