Difference between revisions of "Testing"
From DarkWiki
| Line 1: | Line 1: | ||
==Mockito== | ==Mockito== | ||
| + | |||
| + | ===Terminology=== | ||
| + | |||
| + | *Unit tests* are short, fast and test a single class. | ||
===Argument capture=== | ===Argument capture=== | ||
Revision as of 11:36, 29 November 2019
Mockito
Terminology
- Unit tests* are short, fast and test a single class.
Argument capture
To test to verify a certain value has been passed to a function, you need to use an ArgumentCaptor. This code is placed after the actual call under test.
...
ArgumentCaptor<UserRecord> userRecordCapture = ArgumentCaptor.forClass(UserRecord.class);
Mockito.verify(userRepository).saveUserAccount(userRecordCapture.capture());
Assert.assertEquals("username", userRecordCapture.getValue().getName());
Cypress
Front end testing can be automated through Cypress.