title: JUnit 5 @ParameterizedTest with using class as @ValueSource
body: <p>I want to do a <code>ParameterizedTest</code> with <code>@ValueSource</code> , i have readed many tutorials including <a href="https://www.baeldung.com/parameterized-tests-junit-5" rel="nofollow noreferrer">Guide to JUnit 5 Parameterized Tests</a>:</p>
  
  <pre><code>/**
   * The {@link Class} values to use as sources of arguments; must not be empty.
   *
   * @since 5.1
   */
  Class&lt;?&gt;[] classes() default {};
  </code></pre>
  
  <p>So i tried the following :</p>
  
  <pre><code>@ParameterizedTest
  @ValueSource(classes = {new Mandator("0052", "123456", 79)})
  void testCalculateMandateI(Mandator value) {
  
       //code using Mandator here
  }
  </code></pre>
  
  <p>Mandator class:</p>
  
  <pre><code> public class Mandator {
  
      private String creditorPrefix;
      private String retailerCode;
      private int mandateIdSequence;
  
      public Mandator(final String creditorPrefix, final String retailerCode, final int mandateIdSequence) {
          this.creditorPrefix = creditorPrefix;
          this.retailerCode = retailerCode;
          this.mandateIdSequence = mandateIdSequence;
      }
  
      public String getCreditorPrefix() {
          return creditorPrefix;
      }
  
      public String getRetailerCode() {
          return retailerCode;
      }
  
      public int getMandateIdSequence() {
          return mandateIdSequence;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>But i get the following error from IntelliJ , hovering above @ValueSource :</p>
  
  <p><a href="https://i.stack.imgur.com/V8lUf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V8lUf.png" alt="enter image description here"></a></p>
  
  <p><strong>Attribute value must be a constant</strong> </p>
  
  <p>What am i doing wrong here ? What am i missing ?</p>