Home > Mobile >  Use AssertJ in Spring Boot production code
Use AssertJ in Spring Boot production code

Time:11-02

Is it possible to use AssertJ in Spring Boot production code ? I managed to use it in unit test, but 'import static org.assertj.core.api.Assertions.*;' could not be resolved in java file of src/main/java folder even though I tried to fix it by changing build path and change the of junit. Or it is a bad practice to use AssertJ in production code ?

CodePudding user response:

AssertJ is not designed to be used in production code. In case of input validation with a Spring Boot application, Assert from the Spring Framework, Validate from Apache Commons Lang, or Preconditions from Google Guava may be good alternatives.

  • Related