AEM-junit for text component using textmodel
I am building project with Junit for Text
WHEN I return plain text (Lorem ipsum dolor sit amet.) for getText.
THEN I should see “Lorem ipsum dolor sit amet.” returned for getText().
I am building project with Junit for Text
WHEN I return plain text (Lorem ipsum dolor sit amet.) for getText.
THEN I should see “Lorem ipsum dolor sit amet.” returned for getText().
Hey @vinuu123 ,
Here is a quick reference : unit-testing-aem for Junit testing.
For your usecase, you need to mock the model under the test and command the Junits as and when required like:
If someone is calling a getter from mockModel you can use :
when(mockModel.getSomeProperty).thenReturn("Lorem Ipsum...");
Here's a tutorial on how you use asserting : junit-assert-tutorial .
Please feel free to reach out if that doesnt help. Thanks.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.