tests: ensure contract on FileComparisonFailure - expectedFilePath should be null or point to the existing file

GitOrigin-RevId: aa31c782bc510b90d8abca0ac380fd27d8600008
This commit is contained in:
Anna Kozlova
2021-11-24 17:26:25 +00:00
committed by intellij-monorepo-bot
parent 31c7748884
commit 5e861faf2f
@@ -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;
}