Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should have no parameters #12

Closed
neojoda opened this issue Jul 18, 2013 · 3 comments
Closed

should have no parameters #12

neojoda opened this issue Jul 18, 2013 · 3 comments

Comments

@neojoda
Copy link

neojoda commented Jul 18, 2013

I am getting this error when running the dataprovider:

java.lang.Exception: Method checkValidSNumber_SNumberIsNotValid_returnFalse should have no parameters

I am trying to run it on a grails project.

Test class:

package utils

import org.junit.Before
import org.junit.runner.RunWith
import com.tngtech.java.junit.dataprovider.DataProvider
import com.tngtech.java.junit.dataprovider.DataProviderRunner
import com.tngtech.java.junit.dataprovider.UseDataProvider

/**

  • See the API for {@link grails.test.mixin.services.ServiceUnitTestMixin} for usage instructions
    */
    @testfor(ParamsService)
    @RunWith(DataProviderRunner.class)
    class ParamsServiceTests {

    ParamsService service;

    @before
    void setUp() {

    service = new ParamsService();
    

    }

    @dataProvider
    public static Object[][] dataProviderSnumberNotValids() {

    def array = new Object[1][]
    array[0] = ["R09090909"] as Object[];
    return array;
    

    }

    /**

    • method checkValidSNumber

    • when SNumberIsNotValid

    • should returnFalse
      */
      @test
      @UseDataProvider("dataProviderSnumberNotValids")
      public void checkValidSNumber_SNumberIsNotValid_returnFalse(String SNumber) {

      //String sNumber = "def array = new Object[3][]

      Boolean actual = service.checkValidSNumber(SNumber)

      assert (actual instanceof Boolean) //Guard Assertion
      assert !actual
      }

}

@neojoda
Copy link
Author

neojoda commented Jul 18, 2013

Using JUnit 4.10

@neojoda
Copy link
Author

neojoda commented Jul 18, 2013

I am using grails 2.0.3
It seems that I use eclipse Run as -> Junit Test is working properly, but no when I run grails test-app. It is where I am getting the error.

Thanks for this incredible plugin!

@aaschmid
Copy link
Member

Hi @neojoda,

sorry for the long delay ... unfortunately, this was no problem within the junit-dataprovider. Though, Grails uses a special test runner, see GRAILS-6352. This issue is fixed in version 2.3.:

In order to support alternate JUnit4 test runners, Grails 2.3 no longer uses a
special test runner to run tests [...].

(from http://grails.org/doc/2.3.1/guide/single.html#upgradingFromPreviousVersionsOfGrails, section "Dependency Injection for Integration Tests")

Cheers,
Andreas

@aaschmid aaschmid self-assigned this Mar 7, 2014
@aaschmid aaschmid added the bug label Mar 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants