-> exercise -> verify • Stub • initialize -> exercise -> verify • Class that implements the interface/class you are faking for testing purposes • But, There is no such difference, call whatever you want (KISS)
to a system that is being tested for correct operation. • Depended On Component (DOC), is a collaborator, component that is required by SUT to fulfill its duties
allows to mix mocks and real methods/field • mockk(relaxed = true) (relaxed mock) is a mock with no restriction to set behavior, So it uses simple value like 0 or null for mocked objects
specify that matched call returns one specified value returnsMany: specify that matched call returns value from the list, returning each time next element every { Math.sum(1, 2) } returnsMany listOf(1, 2, 3)
specify that matched call throws an exception just Runs: specify that matched call is returning Unit (returns null) every { Math.printSum(1, 2) } just Runs