diff --git a/java/java-runtime/src/com/intellij/rt/execution/junit/FileComparisonFailure.java b/java/java-runtime/src/com/intellij/rt/execution/junit/FileComparisonFailure.java index cccf7b735b7f..c8bbd5b515f0 100644 --- a/java/java-runtime/src/com/intellij/rt/execution/junit/FileComparisonFailure.java +++ b/java/java-runtime/src/com/intellij/rt/execution/junit/FileComparisonFailure.java @@ -1,22 +1,10 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * 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. - */ +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.rt.execution.junit; import junit.framework.ComparisonFailure; +import java.io.File; + public class FileComparisonFailure extends ComparisonFailure { private final String myExpected; private final String myActual; @@ -34,6 +22,7 @@ public class FileComparisonFailure extends ComparisonFailure { myExpected = expected; myActual = actual; myFilePath = expectedFilePath; + if (expectedFilePath != null && !new File(expectedFilePath).isFile()) throw new NullPointerException("'expectedFilePath' should point to the existing file or be null"); myActualFilePath = actualFilePath; }