26
26
import org .junit .jupiter .api .Assertions ;
27
27
import org .junit .jupiter .api .Test ;
28
28
import org .junit .jupiter .api .extension .ExtendWith ;
29
- import org .mockito .Mock ;
30
29
import org .mockito .junit .jupiter .MockitoExtension ;
31
30
32
31
import ch .xxx .trader .domain .model .dto .CommonStatisticsDto ;
33
32
import ch .xxx .trader .domain .model .dto .RangeDto ;
34
- import ch .xxx .trader .domain .model .entity .MyMongoRepository ;
35
33
import ch .xxx .trader .domain .model .entity .QuoteBf ;
36
34
import ch .xxx .trader .domain .model .entity .QuoteBs ;
37
35
@@ -41,16 +39,16 @@ private enum StatisticKeys {
41
39
getPerformance , getAvgVolume , getRange , getVolatility
42
40
}
43
41
44
- @ Mock
45
- private MyMongoRepository myMongoRepository ;
42
+ // @Mock
43
+ // private MyMongoRepository myMongoRepository;
46
44
47
45
48
46
@ Test
49
47
public void statistic5Years () {
50
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
48
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
51
49
List <QuoteBs > quotesBs = createBsQuotes ();
52
50
CommonStatisticsDto dto = new CommonStatisticsDto ();
53
- statisticService .calcStatistics5Years (quotesBs , dto );
51
+ StatisticService .calcStatistics5Years (quotesBs , dto );
54
52
Assertions .assertEquals (dto .getPerformance5Year ().longValue (), 800L );
55
53
Assertions .assertEquals (dto .getAvgVolume5Year (), BigDecimal .valueOf (50L ));
56
54
Assertions .assertEquals (dto .getRange5Year ().getMin (), BigDecimal .TEN );
@@ -60,10 +58,10 @@ public void statistic5Years() {
60
58
61
59
@ Test
62
60
public void statistic2Years () {
63
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
61
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
64
62
List <QuoteBf > quotesBf = createBfQuotes ();
65
63
CommonStatisticsDto dto = new CommonStatisticsDto ();
66
- statisticService .calcStatistics2Years (quotesBf , dto );
64
+ StatisticService .calcStatistics2Years (quotesBf , dto );
67
65
Assertions .assertEquals (dto .getPerformance2Year ().longValue (), 350L );
68
66
Assertions .assertEquals (dto .getAvgVolume2Year (), BigDecimal .valueOf (55L ));
69
67
Assertions .assertEquals (dto .getRange2Year ().getMin (), BigDecimal .valueOf (20L ));
@@ -73,10 +71,10 @@ public void statistic2Years() {
73
71
74
72
@ Test
75
73
public void statistic1Year () {
76
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
74
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
77
75
List <QuoteBs > quotesBs = createBsQuotes ();
78
76
CommonStatisticsDto dto = new CommonStatisticsDto ();
79
- statisticService .calcStatistics1Year (quotesBs , dto );
77
+ StatisticService .calcStatistics1Year (quotesBs , dto );
80
78
Assertions .assertEquals (dto .getPerformance1Year ().longValue (), 200L );
81
79
Assertions .assertEquals (dto .getAvgVolume1Year (), BigDecimal .valueOf (60L ));
82
80
Assertions .assertEquals (dto .getRange1Year ().getMin (), BigDecimal .valueOf (30L ));
@@ -86,10 +84,10 @@ public void statistic1Year() {
86
84
87
85
@ Test
88
86
public void statistic6Months () {
89
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
87
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
90
88
List <QuoteBf > quotesBf = createBfQuotes ();
91
89
CommonStatisticsDto dto = new CommonStatisticsDto ();
92
- statisticService .calcStatistics6Months (quotesBf , dto );
90
+ StatisticService .calcStatistics6Months (quotesBf , dto );
93
91
Assertions .assertEquals (dto .getPerformance6Month ().longValue (), 125L );
94
92
Assertions .assertEquals (dto .getAvgVolume6Month (), BigDecimal .valueOf (65L ));
95
93
Assertions .assertEquals (dto .getRange6Month ().getMin (), BigDecimal .valueOf (40L ));
@@ -99,10 +97,10 @@ public void statistic6Months() {
99
97
100
98
@ Test
101
99
public void statistic3Months () {
102
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
100
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
103
101
List <QuoteBs > quotesBs = createBsQuotes ();
104
102
CommonStatisticsDto dto = new CommonStatisticsDto ();
105
- statisticService .calcStatistics3Months (quotesBs , dto );
103
+ StatisticService .calcStatistics3Months (quotesBs , dto );
106
104
Assertions .assertEquals (dto .getPerformance3Month ().longValue (), 80L );
107
105
Assertions .assertEquals (dto .getAvgVolume3Month (), BigDecimal .valueOf (70L ));
108
106
Assertions .assertEquals (dto .getRange3Month ().getMin (), BigDecimal .valueOf (50L ));
@@ -112,10 +110,10 @@ public void statistic3Months() {
112
110
113
111
@ Test
114
112
public void statistic1Month () {
115
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
113
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
116
114
List <QuoteBf > quotesBf = createBfQuotes ();
117
115
CommonStatisticsDto dto = new CommonStatisticsDto ();
118
- statisticService .calcStatistics1Month (quotesBf , dto );
116
+ StatisticService .calcStatistics1Month (quotesBf , dto );
119
117
Assertions .assertEquals (dto .getPerformance1Month ().longValue (), 50L );
120
118
Assertions .assertEquals (dto .getAvgVolume1Month (), BigDecimal .valueOf (75L ));
121
119
Assertions .assertEquals (dto .getRange1Month ().getMin (), BigDecimal .valueOf (60L ));
@@ -125,65 +123,65 @@ public void statistic1Month() {
125
123
126
124
@ Test
127
125
public void statistic1MonthEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
128
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
126
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
129
127
List <QuoteBf > quotesBf = List .of ();
130
128
CommonStatisticsDto dto = new CommonStatisticsDto ();
131
- statisticService .calcStatistics1Month (quotesBf , dto );
129
+ StatisticService .calcStatistics1Month (quotesBf , dto );
132
130
String durationStr = "1Month" ;
133
131
134
132
checkEmptyResult (dto , durationStr );
135
133
}
136
134
137
135
@ Test
138
136
public void statistic3MonthEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
139
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
137
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
140
138
List <QuoteBf > quotesBf = List .of ();
141
139
CommonStatisticsDto dto = new CommonStatisticsDto ();
142
- statisticService .calcStatistics3Months (quotesBf , dto );
140
+ StatisticService .calcStatistics3Months (quotesBf , dto );
143
141
String durationStr = "3Month" ;
144
142
145
143
checkEmptyResult (dto , durationStr );
146
144
}
147
145
148
146
@ Test
149
147
public void statistic6MonthEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
150
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
148
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
151
149
List <QuoteBf > quotesBf = List .of ();
152
150
CommonStatisticsDto dto = new CommonStatisticsDto ();
153
- statisticService .calcStatistics6Months (quotesBf , dto );
151
+ StatisticService .calcStatistics6Months (quotesBf , dto );
154
152
String durationStr = "6Month" ;
155
153
156
154
checkEmptyResult (dto , durationStr );
157
155
}
158
156
159
157
@ Test
160
158
public void statistic1YearEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
161
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
159
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
162
160
List <QuoteBf > quotesBf = List .of ();
163
161
CommonStatisticsDto dto = new CommonStatisticsDto ();
164
- statisticService .calcStatistics1Year (quotesBf , dto );
162
+ StatisticService .calcStatistics1Year (quotesBf , dto );
165
163
String durationStr = "1Year" ;
166
164
167
165
checkEmptyResult (dto , durationStr );
168
166
}
169
167
170
168
@ Test
171
169
public void statistic2YearEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
172
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
170
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
173
171
List <QuoteBf > quotesBf = List .of ();
174
172
CommonStatisticsDto dto = new CommonStatisticsDto ();
175
- statisticService .calcStatistics2Years (quotesBf , dto );
173
+ StatisticService .calcStatistics2Years (quotesBf , dto );
176
174
String durationStr = "2Year" ;
177
175
178
176
checkEmptyResult (dto , durationStr );
179
177
}
180
178
181
179
@ Test
182
180
public void statistic5YearEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
183
- StatisticService statisticService = new StatisticService (this .myMongoRepository );
181
+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
184
182
List <QuoteBf > quotesBf = List .of ();
185
183
CommonStatisticsDto dto = new CommonStatisticsDto ();
186
- statisticService .calcStatistics5Years (quotesBf , dto );
184
+ StatisticService .calcStatistics5Years (quotesBf , dto );
187
185
String durationStr = "5Year" ;
188
186
189
187
checkEmptyResult (dto , durationStr );
0 commit comments