java-faker
java-faker copied to clipboard
Company.name throws java.lang.RuntimeException: Unable to resolve #{suffix} directive
Describe the bug I pass the faker key from json file and then get value for it. Using company.name is throwing java.lang.RuntimeException: Unable to resolve #{suffix} directive error often. Sometime it works and sometime it throws the exception
To Reproduce use the company.name faker, run couple of times and you get exception
Expected behavior Should return company name
Versions:
- OS: Windows 10
- JDK 1.8
- Faker Version [1.0.2]
Additional context From the debug, what i observed is, when company.name is passed, fake converts that to name.last_name and starts adding words.
First time a word is returned and during second loop, for some reasons fakervalueservice returning #{suffix} and it throws the exception
Attached the debugger screenshot for further reference
Our gruop have looked carefully at your issue and we're interested. We will try to solve this problem.
--SE_CHWJ
Sorry that we can't reproduce your problem, could you please try it again and if it's still wrong, could you please show more screenshots and details how the error happened, by the way, the screenshot seems to be different from the class in version 1.0.2 in FakeValuesService class, hope you check and best wishes.
I also experience the same issue with company.name The problem is that it is not reproduced all the time (~1 failure on 10 executions)
Caused by: java.lang.RuntimeException: Unable to resolve #{suffix} directive.
at com.github.javafaker.service.FakeValuesService.resolveExpression(FakeValuesService.java:360)
at com.github.javafaker.service.FakeValuesService.resolveExpression(FakeValuesService.java:363)
at com.github.javafaker.service.FakeValuesService.expression(FakeValuesService.java:322)
at com.github.javafaker.Faker.expression(Faker.java:715)
I am trying to evaluate the expression: #{company.name}
But when it comes to resolveExpression method it fails to resolve it: