2626import org .junit .jupiter .api .Assertions ;
2727import org .junit .jupiter .api .Test ;
2828import org .junit .jupiter .api .extension .ExtendWith ;
29- import org .mockito .Mock ;
3029import org .mockito .junit .jupiter .MockitoExtension ;
3130
3231import ch .xxx .trader .domain .model .dto .CommonStatisticsDto ;
3332import ch .xxx .trader .domain .model .dto .RangeDto ;
34- import ch .xxx .trader .domain .model .entity .MyMongoRepository ;
3533import ch .xxx .trader .domain .model .entity .QuoteBf ;
3634import ch .xxx .trader .domain .model .entity .QuoteBs ;
3735
@@ -41,16 +39,16 @@ private enum StatisticKeys {
4139 getPerformance , getAvgVolume , getRange , getVolatility
4240 }
4341
44- @ Mock
45- private MyMongoRepository myMongoRepository ;
42+ // @Mock
43+ // private MyMongoRepository myMongoRepository;
4644
4745
4846 @ Test
4947 public void statistic5Years () {
50- StatisticService statisticService = new StatisticService (this .myMongoRepository );
48+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
5149 List <QuoteBs > quotesBs = createBsQuotes ();
5250 CommonStatisticsDto dto = new CommonStatisticsDto ();
53- statisticService .calcStatistics5Years (quotesBs , dto );
51+ StatisticService .calcStatistics5Years (quotesBs , dto );
5452 Assertions .assertEquals (dto .getPerformance5Year ().longValue (), 800L );
5553 Assertions .assertEquals (dto .getAvgVolume5Year (), BigDecimal .valueOf (50L ));
5654 Assertions .assertEquals (dto .getRange5Year ().getMin (), BigDecimal .TEN );
@@ -60,10 +58,10 @@ public void statistic5Years() {
6058
6159 @ Test
6260 public void statistic2Years () {
63- StatisticService statisticService = new StatisticService (this .myMongoRepository );
61+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
6462 List <QuoteBf > quotesBf = createBfQuotes ();
6563 CommonStatisticsDto dto = new CommonStatisticsDto ();
66- statisticService .calcStatistics2Years (quotesBf , dto );
64+ StatisticService .calcStatistics2Years (quotesBf , dto );
6765 Assertions .assertEquals (dto .getPerformance2Year ().longValue (), 350L );
6866 Assertions .assertEquals (dto .getAvgVolume2Year (), BigDecimal .valueOf (55L ));
6967 Assertions .assertEquals (dto .getRange2Year ().getMin (), BigDecimal .valueOf (20L ));
@@ -73,10 +71,10 @@ public void statistic2Years() {
7371
7472 @ Test
7573 public void statistic1Year () {
76- StatisticService statisticService = new StatisticService (this .myMongoRepository );
74+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
7775 List <QuoteBs > quotesBs = createBsQuotes ();
7876 CommonStatisticsDto dto = new CommonStatisticsDto ();
79- statisticService .calcStatistics1Year (quotesBs , dto );
77+ StatisticService .calcStatistics1Year (quotesBs , dto );
8078 Assertions .assertEquals (dto .getPerformance1Year ().longValue (), 200L );
8179 Assertions .assertEquals (dto .getAvgVolume1Year (), BigDecimal .valueOf (60L ));
8280 Assertions .assertEquals (dto .getRange1Year ().getMin (), BigDecimal .valueOf (30L ));
@@ -86,10 +84,10 @@ public void statistic1Year() {
8684
8785 @ Test
8886 public void statistic6Months () {
89- StatisticService statisticService = new StatisticService (this .myMongoRepository );
87+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
9088 List <QuoteBf > quotesBf = createBfQuotes ();
9189 CommonStatisticsDto dto = new CommonStatisticsDto ();
92- statisticService .calcStatistics6Months (quotesBf , dto );
90+ StatisticService .calcStatistics6Months (quotesBf , dto );
9391 Assertions .assertEquals (dto .getPerformance6Month ().longValue (), 125L );
9492 Assertions .assertEquals (dto .getAvgVolume6Month (), BigDecimal .valueOf (65L ));
9593 Assertions .assertEquals (dto .getRange6Month ().getMin (), BigDecimal .valueOf (40L ));
@@ -99,10 +97,10 @@ public void statistic6Months() {
9997
10098 @ Test
10199 public void statistic3Months () {
102- StatisticService statisticService = new StatisticService (this .myMongoRepository );
100+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
103101 List <QuoteBs > quotesBs = createBsQuotes ();
104102 CommonStatisticsDto dto = new CommonStatisticsDto ();
105- statisticService .calcStatistics3Months (quotesBs , dto );
103+ StatisticService .calcStatistics3Months (quotesBs , dto );
106104 Assertions .assertEquals (dto .getPerformance3Month ().longValue (), 80L );
107105 Assertions .assertEquals (dto .getAvgVolume3Month (), BigDecimal .valueOf (70L ));
108106 Assertions .assertEquals (dto .getRange3Month ().getMin (), BigDecimal .valueOf (50L ));
@@ -112,10 +110,10 @@ public void statistic3Months() {
112110
113111 @ Test
114112 public void statistic1Month () {
115- StatisticService statisticService = new StatisticService (this .myMongoRepository );
113+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
116114 List <QuoteBf > quotesBf = createBfQuotes ();
117115 CommonStatisticsDto dto = new CommonStatisticsDto ();
118- statisticService .calcStatistics1Month (quotesBf , dto );
116+ StatisticService .calcStatistics1Month (quotesBf , dto );
119117 Assertions .assertEquals (dto .getPerformance1Month ().longValue (), 50L );
120118 Assertions .assertEquals (dto .getAvgVolume1Month (), BigDecimal .valueOf (75L ));
121119 Assertions .assertEquals (dto .getRange1Month ().getMin (), BigDecimal .valueOf (60L ));
@@ -125,65 +123,65 @@ public void statistic1Month() {
125123
126124 @ Test
127125 public void statistic1MonthEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
128- StatisticService statisticService = new StatisticService (this .myMongoRepository );
126+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
129127 List <QuoteBf > quotesBf = List .of ();
130128 CommonStatisticsDto dto = new CommonStatisticsDto ();
131- statisticService .calcStatistics1Month (quotesBf , dto );
129+ StatisticService .calcStatistics1Month (quotesBf , dto );
132130 String durationStr = "1Month" ;
133131
134132 checkEmptyResult (dto , durationStr );
135133 }
136134
137135 @ Test
138136 public void statistic3MonthEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
139- StatisticService statisticService = new StatisticService (this .myMongoRepository );
137+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
140138 List <QuoteBf > quotesBf = List .of ();
141139 CommonStatisticsDto dto = new CommonStatisticsDto ();
142- statisticService .calcStatistics3Months (quotesBf , dto );
140+ StatisticService .calcStatistics3Months (quotesBf , dto );
143141 String durationStr = "3Month" ;
144142
145143 checkEmptyResult (dto , durationStr );
146144 }
147145
148146 @ Test
149147 public void statistic6MonthEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
150- StatisticService statisticService = new StatisticService (this .myMongoRepository );
148+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
151149 List <QuoteBf > quotesBf = List .of ();
152150 CommonStatisticsDto dto = new CommonStatisticsDto ();
153- statisticService .calcStatistics6Months (quotesBf , dto );
151+ StatisticService .calcStatistics6Months (quotesBf , dto );
154152 String durationStr = "6Month" ;
155153
156154 checkEmptyResult (dto , durationStr );
157155 }
158156
159157 @ Test
160158 public void statistic1YearEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
161- StatisticService statisticService = new StatisticService (this .myMongoRepository );
159+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
162160 List <QuoteBf > quotesBf = List .of ();
163161 CommonStatisticsDto dto = new CommonStatisticsDto ();
164- statisticService .calcStatistics1Year (quotesBf , dto );
162+ StatisticService .calcStatistics1Year (quotesBf , dto );
165163 String durationStr = "1Year" ;
166164
167165 checkEmptyResult (dto , durationStr );
168166 }
169167
170168 @ Test
171169 public void statistic2YearEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
172- StatisticService statisticService = new StatisticService (this .myMongoRepository );
170+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
173171 List <QuoteBf > quotesBf = List .of ();
174172 CommonStatisticsDto dto = new CommonStatisticsDto ();
175- statisticService .calcStatistics2Years (quotesBf , dto );
173+ StatisticService .calcStatistics2Years (quotesBf , dto );
176174 String durationStr = "2Year" ;
177175
178176 checkEmptyResult (dto , durationStr );
179177 }
180178
181179 @ Test
182180 public void statistic5YearEmpty () throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException {
183- StatisticService statisticService = new StatisticService (this .myMongoRepository );
181+ // StatisticService statisticService = new StatisticService(this.myMongoRepository);
184182 List <QuoteBf > quotesBf = List .of ();
185183 CommonStatisticsDto dto = new CommonStatisticsDto ();
186- statisticService .calcStatistics5Years (quotesBf , dto );
184+ StatisticService .calcStatistics5Years (quotesBf , dto );
187185 String durationStr = "5Year" ;
188186
189187 checkEmptyResult (dto , durationStr );
0 commit comments