Testing classes using threads, events, and private methods

general consensus

I read a lot about testing complex classes and private methods.

The general consensus seems to be as follows:

  • "if you need to test your personal methods, then you are a poorly designed class"
  • "if your class is complex, then you need to separate it"

So I need your help.

class problem

So, I have a relatively simple class whose long work is as follows:

  • polling a data source
  • make very simple data mapping
  • send this data to another place

Aditionally:

  • it should be able to be sufficiently fault tolerant, being able to repeat various tasks in case of certain errors.

testing problem

- ... , Timer ..

- ... .

... , ?

+3
2

, , , . , , , .

, . , , . , unit test.

, . . IEnumerable yield . , , , . , , .

, , . - , Java MultithreadedTC, TickingTest.

+4

- JMock. , . , , , .

: ! #. , #, JMock.

+1

Source: https://habr.com/ru/post/1771595/


All Articles