Code example for Stopwatch

0
@RunWith(MockitoJUnitRunner.class) 
public class UpdateLogTest { 
    @Mock UpdateRequest updateRequest; 
    @Mock UpdateContext updateContext; 
    @Mock Update update; 
    Stopwatch stopwatch = new Stopwatch(); 
 
    @Mock Logger logger; 
    @InjectMocks UpdateLog subject; 
 
    @Test 
    public void logUpdateResult_create_success() { 
        final RpslObject maintainer = RpslObject.parse("mntner: TST-MNT"); 
        final UpdateResult updateResult = new UpdateResult(maintainer, maintainer, Action.CREATE, UpdateStatus.SUCCESS, new ObjectMessages(), 0, false); 
        when(update.getCredentials()).thenReturn(new Credentials()); 
        when(updateContext.createUpdateResult(update)).thenReturn(updateResult); 
 
        subject.logUpdateResult(updateRequest, updateContext, update, stopwatch); 
 
        verify(logger).info(matches("\\[\\s*0\\] 0[,.]000 ns   UPD CREATE mntner       TST-MNT                        \\(1\\) SUCCESS               : <E0,W0,I0> AUTH  - null")); 
Stop searching for code, let great code find you!  Add Codota to your java IDE