Difference between revisions of "Testing"

From DarkWiki
Jump to: navigation, search
(Cypress)
Line 3: Line 3:
 
===Argument capture===
 
===Argument capture===
  
To test to verify a certain value has been passed to a function, you need to use an ArgumentCaptor.
+
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.
  
 
<source lang="java">
 
<source lang="java">

Revision as of 13:41, 8 March 2018

Mockito

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.