Hi I'm new to Java and Spring, and currently have a situation that is similar to this:
In Message.java
public class Message {
final String text;
public Message(@Value("${message.text}") String text) {
this.text = text;
}
}
In application.properties:
message.text = "This is some text."
Now, I have a test file where I want to write a test that checks the value of the String text, akin to something like
assertEquals(text, "This is some text.");
How would I go about doing this? It seems I can't manually invoke the constructor by doing new Message("...")
because that overrides the @Value injection.