Java

Mockito

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

Mockito krijon objekte false për teste në Java: when(repo.findById(1L)).thenReturn(...) i tregon objektit false çfarë të kthejë, dhe verify() kontrollon nëse u thirr.

EnglishEN

Mockito creates fake objects for Java tests: when(repo.findById(1L)).thenReturn(...) tells the fake what to return, and verify() checks whether it was called.

Si ta mendosh

Si kukulla e provës në testet e sigurisë së veturave.

Lexoje në anglisht

Like a crash-test dummy in car safety tests.

Shembull kodijava

TermaRepository repo = mock(TermaRepository.class);
when(repo.count()).thenReturn(42L);
assertEquals(42L, new TermaService(repo).numero());

Terma të lidhur