SDET Daily Development Errors
Development becomes a pain in the neck in some cases. I will share the most common errors I have faced during my SDET experience and more to come…
java.lang.IllegalArgumentException: Don’t know how to encode
When I send “POST” request — — java.lang.IllegalArgumentException: Don’t know how to encodeI should be able to bypass this error with a line of code:For example: “given().config(RestAssured.config().encoderConfig(encoderConfig().encodeContentTypeAs(“application json”, ContentType.TEXT))). ..”
OR with
.relaxedHTTPSValidation()
IDEA 10.5 Command line is too long
Setting the Shorten command line: JAR manifest in Run/Debug Configurations resolves the issue.
- If you don’t see this option in the menu press “Modify options v Alt+M” dropdown menu and check “Shorten command line” option to show it (IDEA CE 2020.3).
- Edit the run config, click on ALT + M shorten CML, and select the JAR option
Maven plugins can not be found in IntelliJ
For newer versions of IntelliJ, enable the use plugin registry option within the Maven settings as follows:
- Click File, Settings.
- Expand Build, Execution, Deployment, Build Tools, Maven.
- Check Use plugin registry.
- Click OK or Apply.
Don’t know how to encode as a byte stream — API Error
Add the header:
|Content-Type|application/json; charset=utf-8 |
java.lang.runtimeexception: could not find file or read it intellij can’t read files
Go to Runners,
Edit Configuration — -> Change the classpath.
RuntimeException: Could NOT find the file or read it, this is a similar problem that can be fixed over Runner, Configuration.
Local Repo Metadata Update
The local repository need to know that metadata files were updated. This can be done by the parameter:
mvn -U:
-U, — update-snapshots Forces a check for updated releases and snapshots on remote
For example:
mvn -U clean package
Cucumber Dependnecy Error
java.lang.NoClassDefFoundError: io/cucumber/stepexpression/TypeRegistry
Add below dependency:
<! — https://mvnrepository.com/artifact/io.cucumber/cucumber-java →<dependency><groupId>io.cucumber</groupId><artifactId>cucumber-java</artifactId><version>6.9.0</version></dependency>