File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
java/telegram/bot/services/basicStatisticService
resources/fixtures/follower Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ package telegram .bot .services .basicStatisticService ;
2+
3+ import org .junit .jupiter .api .BeforeEach ;
4+ import org .junit .jupiter .api .Test ;
5+ import telegram .bot .util .FileReaderForTest ;
6+
7+ import static org .junit .jupiter .api .Assertions .assertEquals ;
8+
9+ class FollowerServiceTest {
10+ private FollowerService service ;
11+ private String directory ;
12+
13+ @ BeforeEach
14+ void setUp () {
15+ service = new FollowerService ();
16+ directory = "src/test/resources/fixtures/follower/" ;
17+ }
18+
19+ @ Test
20+ void create () throws Exception {
21+
22+ var file = FileReaderForTest .readJsonNodeFromFile (directory + "create.json" );
23+ var follower = service .create (file );
24+
25+ assertEquals (10 , follower .getFollowers ());
26+ assertEquals (5 , follower .getFollowing ());
27+ }
28+
29+ @ Test
30+ void createZeroCounts () throws Exception {
31+
32+ var file = FileReaderForTest .readJsonNodeFromFile (directory + "zeroCounts.json" );
33+ var follower = service .create (file );
34+
35+ assertEquals (0 , follower .getFollowers ());
36+ assertEquals (0 , follower .getFollowing ());
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ {
2+ "followers" : {
3+ "totalCount" : 10
4+ },
5+ "following" : {
6+ "totalCount" : 5
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ {
2+
3+ }
You can’t perform that action at this time.
0 commit comments