@Test public void shouldApplyCurrentCurrency() throws Exception { // given FieldComponent field = mock(FieldComponent.class); Long currencyId = 1L; when(view.getComponentByReference("currency")).thenReturn(field); when(currencyService.getCurrentCurrency()).thenReturn(currency); when(currency.getId()).thenReturn(currencyId); // when currencyViewService.applyCurrentCurrency(view); // then Mockito.verify(field).setFieldValue(currencyId); }