I have a Spring Boot application, using Spring 4, in this app I have an interface and an implementing class:
interface Sorter{
void start();
List<MailingListMessage> getMessages();
}
and
@Service
public class SorterImpl implements Sorter {
List<MailingListMessage> messages;
@Override
public void start() {
}
@Override
public List<MailingListMessage> getMessages() {
return null;
}
}
What I want to to is test the implementation directly but still as a bean with autowiring and everything.
I want to do that because when I need to assert something that for example relates to messages, I have to make the method public as you can see in the Impl class.
Is there a way in Spring to properly write tests for implementations directly and still have them work as beans?
Thanks.
Aucun commentaire:
Enregistrer un commentaire