sbtqa/page-factory-2

REST. Boby "private int num;" llegalArgumentException: Can not set int field

Closed this issue · 1 comments

Добрый день!
Есть необходимость в ресте отправлять значение num без кавычек.
Судя по документации необходимо в классе вместо String указать int. Но при указании int возникает ошибка.
Версии
<pf2.version>14.9.0</pf2.version>
<pf2.version>13.0.3</pf2.version>

Класс rest.endpoints.Document
@Body(name = "num")
private int num;

ru.sbtqa.tag.api.exception.RestPluginException: Body with name "num" is not available

Caused by: java.lang.IllegalArgumentException: Can not set int field
путь до класса.Document.num to java.lang.String

ru.sbtqa.tag.api.exception.RestPluginException: Body with name "num" is not available

            at ru.sbtqa.tag.api.utils.ReflectionUtils.set(ReflectionUtils.java:30)

            at ru.sbtqa.tag.api.EndpointEntryReflection.setParameterValueByTitle(EndpointEntryReflection.java:93)

            at ru.sbtqa.tag.api.EndpointEntry.send(EndpointEntry.java:60)

            at ru.sbtqa.tag.api.junit.ApiStepsImpl.send_aroundBody6(ApiStepsImpl.java:79)

            at ru.sbtqa.tag.api.junit.ApiStepsImpl$AjcClosure7.run(ApiStepsImpl.java:1)

            at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)

            at ru.sbtqa.tag.pagefactory.allure.JunitReporter.handleStep(JunitReporter.java:34)

            at ru.sbtqa.tag.api.aspects.JUnitApiStepAspect.handleStep(JUnitApiStepAspect.java:13)

            at ru.sbtqa.tag.api.junit.ApiStepsImpl.send(ApiStepsImpl.java:78)

            at ru.sbtqa.tag.stepdefs.ru.ApiStepDefs.send(ApiStepDefs.java:38)

            at ✽.он отправляет запрос "Document" с параметрами:(src/test/resources/features/rest/test1.feature:7)

Caused by: java.lang.IllegalArgumentException: Can not set int field
путь до класса.Document.num to java.lang.String

            at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)

            at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)

            at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:98)

            at java.lang.reflect.Field.set(Field.java:764)

            at ru.sbtqa.tag.api.utils.ReflectionUtils.set(ReflectionUtils.java:28)

            at ru.sbtqa.tag.api.EndpointEntryReflection.setParameterValueByTitle(EndpointEntryReflection.java:93)

            at ru.sbtqa.tag.api.EndpointEntry.send(EndpointEntry.java:60)

            at ru.sbtqa.tag.api.junit.ApiStepsImpl.send_aroundBody6(ApiStepsImpl.java:79)

            at ru.sbtqa.tag.api.junit.ApiStepsImpl$AjcClosure7.run(ApiStepsImpl.java:1)

            at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)

            at ru.sbtqa.tag.pagefactory.allure.JunitReporter.handleStep(JunitReporter.java:34)

            at ru.sbtqa.tag.api.aspects.JUnitApiStepAspect.handleStep(JUnitApiStepAspect.java:13)

            at ru.sbtqa.tag.api.junit.ApiStepsImpl.send(ApiStepsImpl.java:78)

            at ru.sbtqa.tag.stepdefs.ru.ApiStepDefs.send(ApiStepDefs.java:38)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at cucumber.runtime.Utils$1.call(Utils.java:32)

            at cucumber.runtime.Timeout.timeout(Timeout.java:16)

            at cucumber.runtime.Utils.invoke(Utils.java:26)

            at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:37)

            at cucumber.runtime.StepDefinitionMatch.runStep_aroundBody0(StepDefinitionMatch.java:40)

            at cucumber.runtime.StepDefinitionMatch$AjcClosure1.run(StepDefinitionMatch.java:1)

            at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)

            at ru.sbtqa.tag.pagefactory.aspects.CriticalStepCheckAspect.runStep(CriticalStepCheckAspect.java:68)

            at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:40)

            at cucumber.api.TestStep.executeStep_aroundBody2(TestStep.java:102)

            at cucumber.api.TestStep$AjcClosure3.run(TestStep.java:1)

            at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)

            at ru.sbtqa.tag.pagefactory.aspects.DataAspect.executeStep(DataAspect.java:106)

            at cucumber.api.TestStep.executeStep(TestStep.java:101)

            at cucumber.api.TestStep.run_aroundBody0(TestStep.java:83)

            at cucumber.api.TestStep$AjcClosure1.run(TestStep.java:1)

            at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)

            at ru.sbtqa.tag.pagefactory.aspects.DataAspect.run(DataAspect.java:87)

            at cucumber.api.TestStep.run(TestStep.java:78)

            at cucumber.api.TestCase.run(TestCase.java:58)

            at cucumber.runner.Runner.runPickle(Runner.java:80)

            at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)

            at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)

            at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)

            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

            at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)

            at cucumber.api.junit.Cucumber.runChild(Cucumber.java:118)

            at cucumber.api.junit.Cucumber.runChild(Cucumber.java:56)

            at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

            at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

            at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:127)

            at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

            at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)

            at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)

            at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)

            at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)

            at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)

            at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)

            at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)

@yaroslav796 проверь плз на релизе 15.18.0