congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Parameterized$Parameter.value
Code IndexAdd Tabnine to your IDE (free)

How to use
value
method
in
org.junit.runners.Parameterized$Parameter

Best Java code snippets using org.junit.runners.Parameterized$Parameter.value (Showing top 20 results out of 315)

origin: google/j2objc

@Override
protected void validateFields(List<Throwable> errors) {
  super.validateFields(errors);
  if (fieldsAreAnnotated()) {
    List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
    int[] usedIndices = new int[annotatedFieldsByParameter.size()];
    for (FrameworkField each : annotatedFieldsByParameter) {
      int index = each.getField().getAnnotation(Parameter.class).value();
      if (index < 0 || index > annotatedFieldsByParameter.size() - 1) {
        errors.add(
            new Exception("Invalid @Parameter value: " + index + ". @Parameter fields counted: " +
                annotatedFieldsByParameter.size() + ". Please use an index between 0 and " +
                (annotatedFieldsByParameter.size() - 1) + ".")
        );
      } else {
        usedIndices[index]++;
      }
    }
    for (int index = 0; index < usedIndices.length; index++) {
      int numberOfUse = usedIndices[index];
      if (numberOfUse == 0) {
        errors.add(new Exception("@Parameter(" + index + ") is never used."));
      } else if (numberOfUse > 1) {
        errors.add(new Exception("@Parameter(" + index + ") is used more than once (" + numberOfUse + ")."));
      }
    }
  }
}
origin: hibernate/hibernate-orm

@Override
protected void validateFields(List<Throwable> errors) {
  super.validateFields(errors);
  if (fieldsAreAnnotated()) {
    List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
    int[] usedIndices = new int[annotatedFieldsByParameter.size()];
    for (FrameworkField each : annotatedFieldsByParameter) {
      int index = each.getField().getAnnotation(Parameterized.Parameter.class).value();
      if (index < 0 || index > annotatedFieldsByParameter.size() - 1) {
        errors.add(
            new Exception("Invalid @Parameter value: " + index + ". @Parameter fields counted: " +
                annotatedFieldsByParameter.size() + ". Please use an index between 0 and " +
                (annotatedFieldsByParameter.size() - 1) + ".")
        );
      }
      else {
        usedIndices[index]++;
      }
    }
    for (int index = 0; index < usedIndices.length; index++) {
      int numberOfUse = usedIndices[index];
      if (numberOfUse == 0) {
        errors.add(new Exception("@Parameter(" + index + ") is never used."));
      }
      else if (numberOfUse > 1) {
        errors.add(new Exception("@Parameter(" + index + ") is used more than once (" + numberOfUse + ")."));
      }
    }
  }
}
origin: google/j2objc

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields." +
        " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    } catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() +
          " with the value " + fParameters[index] +
          " that is not the right type (" + fParameters[index].getClass().getSimpleName() + " instead of " +
          field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: ops4j/org.ops4j.pax.exam2

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + parameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + parameters[index] + " that is not the right type ("
        + parameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: com.impetus.fabric/fabric-jdbc-driver-shaded

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception(
        "Wrong number of parameters and @Parameter fields."
            + " @Parameter fields counted: "
            + annotatedFieldsByParameter.size()
            + ", available parameters: " + parameters.length
            + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    } catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName()
          + ": Trying to set " + field.getName()
          + " with the value " + parameters[index]
          + " that is not the right type ("
          + parameters[index].getClass().getSimpleName()
          + " instead of " + field.getType().getSimpleName()
          + ").", iare);
    }
  }
  return testClassInstance;
}
origin: ops4j/org.ops4j.pax.exam2

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + fParameters[index] + " that is not the right type ("
        + fParameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: org.ops4j.pax.exam/pax-exam-servlet-bridge

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + parameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + parameters[index] + " that is not the right type ("
        + parameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: ops4j/org.ops4j.pax.exam2

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + fParameters[index] + " that is not the right type ("
        + fParameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: org.ops4j.pax.exam/pax-exam-invoker-junit

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + parameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + parameters[index] + " that is not the right type ("
        + parameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: ops4j/org.ops4j.pax.exam2

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + parameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + parameters[index] + " that is not the right type ("
        + parameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: com.github.peterwippermann.junit4/parameterized-suite

/**
 * @see BlockJUnit4ClassRunnerWithParameters#createTestUsingFieldInjection()
 */
private static Object createTestUsingFieldInjection(TestClass testClass, Object[] parameters) throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter(testClass);
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields." + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
        + ", available parameters: " + parameters.length + ".");
  }
  Object testClassInstance = testClass.getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameterized.Parameter annotation = field.getAnnotation(Parameterized.Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    } catch (IllegalArgumentException iare) {
      throw new Exception(
          testClass.getName() + ": Trying to set " + field.getName() + " with the value " + parameters[index] + " that is not the right type ("
              + parameters[index].getClass().getSimpleName() + " instead of " + field.getType().getSimpleName() + ").",
          iare);
    }
  }
  return testClassInstance;
}
origin: org.junit/com.springsource.org.junit

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields." +
        " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    } catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() +
          " with the value " + fParameters[index] +
          " that is not the right type (" + fParameters[index].getClass().getSimpleName() + " instead of " +
          field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: com.oracle/truffle-tck

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields." +
        " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    } catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() +
          " with the value " + fParameters[index] +
          " that is not the right type (" + fParameters[index].getClass().getSimpleName() + " instead of " +
          field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: org.ops4j.pax.exam/pax-exam-junit4

@Override
protected void validateFields(List<Throwable> errors) {
  super.validateFields(errors);
  if (fieldsAreAnnotated()) {
    List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
    int[] usedIndices = new int[annotatedFieldsByParameter.size()];
    for (FrameworkField each : annotatedFieldsByParameter) {
      int index = each.getField().getAnnotation(Parameter.class).value();
      if (index < 0 || index > annotatedFieldsByParameter.size() - 1) {
        errors.add(new Exception("Invalid @Parameter value: " + index
          + ". @Parameter fields counted: " + annotatedFieldsByParameter.size()
          + ". Please use an index between 0 and "
          + (annotatedFieldsByParameter.size() - 1) + "."));
      }
      else {
        usedIndices[index]++;
      }
    }
    for (int index = 0; index < usedIndices.length; index++) {
      int numberOfUse = usedIndices[index];
      if (numberOfUse == 0) {
        errors.add(new Exception("@Parameter(" + index + ") is never used."));
      }
      else if (numberOfUse > 1) {
        errors.add(new Exception("@Parameter(" + index + ") is used more than once ("
          + numberOfUse + ")."));
      }
    }
  }
}
origin: camunda/camunda-bpm-platform

@Override
protected void validateFields(List<Throwable> errors) {
  super.validateFields(errors);
  if (fieldsAreAnnotated()) {
    List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
    int[] usedIndices = new int[annotatedFieldsByParameter.size()];
    for (FrameworkField each : annotatedFieldsByParameter) {
      int index = each.getField().getAnnotation(Parameter.class).value();
      if (index < 0 || index > annotatedFieldsByParameter.size() - 1) {
        errors.add(
            new Exception("Invalid @Parameter value: " + index + ". @Parameter fields counted: " +
                annotatedFieldsByParameter.size() + ". Please use an index between 0 and " +
                (annotatedFieldsByParameter.size() - 1) + ".")
        );
      } else {
        usedIndices[index]++;
      }
    }
    for (int index = 0; index < usedIndices.length; index++) {
      int numberOfUse = usedIndices[index];
      if (numberOfUse == 0) {
        errors.add(new Exception("@Parameter(" + index + ") is never used."));
      } else if (numberOfUse > 1) {
        errors.add(new Exception("@Parameter(" + index + ") is used more than once (" + numberOfUse + ")."));
      }
    }
  }
}
origin: org.ops4j.pax.exam/pax-exam-junit4

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields."
      + " @Parameter fields counted: " + annotatedFieldsByParameter.size()
      + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName()
        + " with the value " + fParameters[index] + " that is not the right type ("
        + fParameters[index].getClass().getSimpleName() + " instead of "
        + field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: camunda/camunda-bpm-platform

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != fParameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields." +
        " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + fParameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameter annotation = field.getAnnotation(Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, fParameters[index]);
    } catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() +
          " with the value " + fParameters[index] +
          " that is not the right type (" + fParameters[index].getClass().getSimpleName() + " instead of " +
          field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
origin: junit-team/junit4

Field field = each.getField();
Parameter annotation = field.getAnnotation(Parameter.class);
int index = annotation.value();
try {
  field.set(testClassInstance, parameters[index]);
origin: junit-team/junit4

for (FrameworkField each : annotatedFieldsByParameter) {
  int index = each.getField().getAnnotation(Parameter.class)
      .value();
  if (index < 0 || index > annotatedFieldsByParameter.size() - 1) {
    errors.add(new Exception("Invalid @Parameter value: "
origin: hibernate/hibernate-orm

private Object createTestUsingFieldInjection() throws Exception {
  List<FrameworkField> annotatedFieldsByParameter = getAnnotatedFieldsByParameter();
  if (annotatedFieldsByParameter.size() != parameters.length) {
    throw new Exception("Wrong number of parameters and @Parameter fields." +
        " @Parameter fields counted: " + annotatedFieldsByParameter.size() + ", available parameters: " + parameters.length + ".");
  }
  Object testClassInstance = getTestClass().getJavaClass().newInstance();
  for (FrameworkField each : annotatedFieldsByParameter) {
    Field field = each.getField();
    Parameterized.Parameter annotation = field.getAnnotation(Parameterized.Parameter.class);
    int index = annotation.value();
    try {
      field.set(testClassInstance, parameters[index]);
    }
    catch (IllegalArgumentException iare) {
      throw new Exception(getTestClass().getName() + ": Trying to set " + field.getName() +
          " with the value " + parameters[index] +
          " that is not the right type (" + parameters[index].getClass().getSimpleName() + " instead of " +
          field.getType().getSimpleName() + ").", iare);
    }
  }
  return testClassInstance;
}
org.junit.runnersParameterized$Parametervalue

Popular methods of Parameterized$Parameter

  • <init>

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • String (java.lang)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now