0

I have a method I want to test but it's marked with @PostConstruct annotation. This method at some point, throw an exception. Is it possible to test a method with such annotation using JUnit tests? Asking in general here rather than for a specific method

1 Answers1

0

Yes, you can test it as usual method, because @PostConstruct is Spring-specific annotation and isn't related to JUnit (this annotation will be proceed only if you use features from spring-test library like SpringRunner, @SpringBootTest and so on).

amseager
  • 5,795
  • 4
  • 24
  • 47