From 3db05ff83997ede30a8cfa8a67c4d795491008c4 Mon Sep 17 00:00:00 2001 From: Konstantin Ulitin Date: Thu, 28 May 2015 19:48:27 +0300 Subject: [PATCH] add contract to UsefulTestCase.assertInstanceOf --- .../src/com/intellij/testFramework/UsefulTestCase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index fec7abf3a2bc..8f020307e100 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -51,6 +51,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; import org.intellij.lang.annotations.RegExp; import org.jdom.Element; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -656,6 +657,7 @@ public abstract class UsefulTestCase extends TestCase { } } + @Contract("null, _ -> fail") public static T assertInstanceOf(Object o, Class aClass) { Assert.assertNotNull("Expected instance of: " + aClass.getName() + " actual: " + null, o); Assert.assertTrue("Expected instance of: " + aClass.getName() + " actual: " + o.getClass().getName(), aClass.isInstance(o));