From 243eeb0364cb2e493b2ce0607665e5c6efb3fcbd Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Sat, 25 Jun 2016 15:16:28 +0200 Subject: [PATCH] make IG test light --- .../MathRandomCastToInt.java | 4 +-- .../bugs/math_random_cast_to_int/expected.xml | 17 ---------- .../MathRandomCastToIntInspectionTest.java | 34 ++++++++++++++++--- 3 files changed, 32 insertions(+), 23 deletions(-) delete mode 100644 plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/expected.xml diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/MathRandomCastToInt.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/MathRandomCastToInt.java index 0b10b4ee07d5..a470067de409 100644 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/MathRandomCastToInt.java +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/MathRandomCastToInt.java @@ -3,7 +3,7 @@ package com.siyeh.igtest.bugs.math_random_cast_to_int; public class MathRandomCastToInt { void foo() { - int runs = (int) Math.random() * 1000000 * 2; - long random = (long) Math.random() * 10; + int runs = (int) Math.random() * 1000000 * 2; + long random = (long) Math.random() * 10; } } diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/expected.xml deleted file mode 100644 index f607e329d8c7..000000000000 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/math_random_cast_to_int/expected.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - MathRandomCastToInt.java - 6 - 'Math.random()' cast to 'int' - <code>Math.random()</code> cast to 'int' is always rounded down to '0' #loc - - - - MathRandomCastToInt.java - 7 - <code>Math.random()</code> cast to 'int' is always rounded down to '0' #loc - - - \ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/MathRandomCastToIntInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/MathRandomCastToIntInspectionTest.java index 63ade15cbf04..689b565569de 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/MathRandomCastToIntInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/bugs/MathRandomCastToIntInspectionTest.java @@ -1,10 +1,36 @@ +/* + * Copyright 2000-2016 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. + */ package com.siyeh.ig.bugs; -import com.siyeh.ig.IGInspectionTestCase; +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; -public class MathRandomCastToIntInspectionTest extends IGInspectionTestCase { +/** + * @author Bas Leijdekkers + */ +public class MathRandomCastToIntInspectionTest extends LightInspectionTestCase { - public void test() throws Exception { - doTest("com/siyeh/igtest/bugs/math_random_cast_to_int", new MathRandomCastToIntInspection()); + public void testMathRandomCastToInt() { + doTest(); + } + + @Nullable + @Override + protected InspectionProfileEntry getInspection() { + return new MathRandomCastToIntInspection(); } }