Class TestUtils

java.lang.Object
org.tudalgo.algoutils.reflect.TestUtils

@Deprecated(since="0.7.0", forRemoval=true) public final class TestUtils extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
A utility class used for JUnit tests which provides reflective access to some properties and assertions. This class is deprecated and will be removed in a future release. Use the new API located in the org.tudalgo.algoutils.tutor.general.reflections package instead.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    assertModifier(int expected, int actual, String name)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Tests whether the modifiers are correct.
    static void
    assertModifier(int expected, Class<?> clazz)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Tests whether the modifiers of a class are correct.
    static void
    assertModifier(int expected, Constructor<?> constructor)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Tests whether the modifiers of a constructor are correct.
    static void
    assertModifier(int expected, Field attribut)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Tests whether the modifiers of a field are correct.
    static void
    assertModifier(int expected, Method method)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Tests whether the modifiers of a method are correct.
    static int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Calculates the similarity (a number within 0 and 1) between two strings.
    static Class<?>[]
    getClasses(String packageName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Scans all classes accessible from the context class loader which belong to the given package and subpackages.
    static boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    static double
    Deprecated, for removal: This API element is subject to removal in a future version.
    Calculates the similarity (a number within 0 and 1) between two strings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BRIDGE

      public static final int BRIDGE
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • VARARGS

      public static final int VARARGS
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • SYNTHETIC

      public static final int SYNTHETIC
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • ANNOTATION

      public static final int ANNOTATION
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • ENUM

      public static final int ENUM
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
    • MANDATED

      public static final int MANDATED
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
  • Method Details

    • assertModifier

      public static void assertModifier(int expected, int actual, String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tests whether the modifiers are correct.
      Parameters:
      expected - the expected modifier count
      actual - the actual modifier count
      name - the name of the field to be checked
    • assertModifier

      public static void assertModifier(int expected, Class<?> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tests whether the modifiers of a class are correct.
      Parameters:
      expected - the expected modifier count
      clazz - the class to be checked
    • assertModifier

      public static void assertModifier(int expected, Method method)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tests whether the modifiers of a method are correct.
      Parameters:
      expected - the expected modifier count
      method - the method to be checked
    • assertModifier

      public static void assertModifier(int expected, Constructor<?> constructor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tests whether the modifiers of a constructor are correct.
      Parameters:
      expected - the expected modifier count
      constructor - the constructor to be checked
    • assertModifier

      public static void assertModifier(int expected, Field attribut)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tests whether the modifiers of a field are correct.
      Parameters:
      expected - the expected modifier count
      attribut - the field to be checked
    • similarity

      public static double similarity(String s1, String s2)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calculates the similarity (a number within 0 and 1) between two strings.
      Parameters:
      s1 - the first string used for the calculation of the similarity
      s2 - the second string used for the calculation of the similarity
      Returns:
      the similarity
    • editDistance

      public static int editDistance(String s1, String s2)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calculates the similarity (a number within 0 and 1) between two strings.
      Parameters:
      s1 - the first string used for the calculation of the similarity
      s2 - the second string used for the calculation of the similarity
      Returns:
      the calculated similarity (a number within 0 and 1) between two strings.
      See Also:
    • getClasses

      public static Class<?>[] getClasses(String packageName) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Scans all classes accessible from the context class loader which belong to the given package and subpackages.
      Parameters:
      packageName - The base package name
      Returns:
      the found classes
      Throws:
      IOException - if an I/O Exception occurs
    • isAutograderRun

      @Deprecated(since="0.7.0", forRemoval=true) public static boolean isAutograderRun()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns true if TestCycleResolver.getTestCycle() does not return null. This method is deprecated and will be removed in a future release. Use Utils.isJagrRun() instead.
      Returns:
      true if TestCycleResolver.getTestCycle() does not return null