title: Writing a parameterized test method in spock
body: <p>I'm writing a test in Spock and currently, this is the base structure:</p>
  
  <pre><code>def "someTest"(String str, Class&lt;? extends SomeClass&gt; clazz) {
  
      setup:
         (current implementation)
         obj.get("Sample1")
         obj.get("Sample2")
         obj.get("Sample3")
         ... so on
  
         (what I want to implement)
         object.get(str)
  
      when:
      ...
  
      then:
      ...
  }
  </code></pre>
  
  <p>I need to use <code>str</code> and <code>clazz</code> in <code>setup:</code>, <code>when:</code> and <code>then:</code> and so I need a way to call the method multiple times. </p>
  
  <p>I've already read some tuts online: <a href="https://www.testwithspring.com/lesson/writing-parameterized-tests-with-spock-framework/" rel="nofollow noreferrer">https://www.testwithspring.com/lesson/writing-parameterized-tests-with-spock-framework/</a> but really have no idea on how to implement it with non-primitive types </p>