File tree 4 files changed +7
-21
lines changed
main/java/ru/mystamps/web
test/groovy/ru/mystamps/web/service 4 files changed +7
-21
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public String showInfo(
72
72
model .addAttribute ("categoryCounter" , categoryService .countCategoriesOf (collection ));
73
73
model .addAttribute ("countryCounter" , countryService .countCountriesOf (collection ));
74
74
model .addAttribute ("seriesCounter" , seriesService .countSeriesOf (collectionId ));
75
- model .addAttribute ("stampsCounter" , seriesService .countStampsOf (collection ));
75
+ model .addAttribute ("stampsCounter" , seriesService .countStampsOf (collectionId ));
76
76
77
77
model .addAttribute (
78
78
"statOfCollectionByCategories" ,
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public interface SeriesService {
37
37
long countAll ();
38
38
long countAllStamps ();
39
39
long countSeriesOf (Integer collectionId );
40
- long countStampsOf (Collection collection );
40
+ long countStampsOf (Integer collectionId );
41
41
42
42
long countByMichelNumber (String michelNumberCode );
43
43
long countByScottNumber (String scottNumberCode );
Original file line number Diff line number Diff line change @@ -169,11 +169,10 @@ public long countSeriesOf(Integer collectionId) {
169
169
170
170
@ Override
171
171
@ Transactional (readOnly = true )
172
- public long countStampsOf (Collection collection ) {
173
- Validate .isTrue (collection != null , "Collection must be non null" );
174
- Validate .isTrue (collection .getId () != null , "Collection id must be non null" );
172
+ public long countStampsOf (Integer collectionId ) {
173
+ Validate .isTrue (collectionId != null , "Collection id must be non null" );
175
174
176
- return jdbcSeriesDao .countStampsOfCollection (collection . getId () );
175
+ return jdbcSeriesDao .countStampsOfCollection (collectionId );
177
176
}
178
177
179
178
@ Override
Original file line number Diff line number Diff line change @@ -576,31 +576,18 @@ class SeriesServiceImplTest extends Specification {
576
576
// Tests for countStampsOf()
577
577
//
578
578
579
- def " countStampsOf() should throw exception when collection is null" () {
579
+ def " countStampsOf() should throw exception when argument is null" () {
580
580
when :
581
581
service. countStampsOf(null )
582
582
then :
583
583
thrown IllegalArgumentException
584
584
}
585
585
586
- def " countStampsOf() should throw exception when collection id is null" () {
587
- given :
588
- Collection collection = Mock ()
589
- collection. getId() >> null
590
- when :
591
- service. countStampsOf(collection)
592
- then :
593
- thrown IllegalArgumentException
594
- }
595
-
596
586
def " countStampsOf() should pass arguments to dao" () {
597
587
given :
598
588
Integer expectedCollectionId = 8
599
- and :
600
- Collection expectedCollection = Mock ()
601
- expectedCollection. getId() >> expectedCollectionId
602
589
when :
603
- service. countStampsOf(expectedCollection )
590
+ service. countStampsOf(expectedCollectionId )
604
591
then :
605
592
1 * jdbcSeriesDao. countStampsOfCollection({ Integer collectionId ->
606
593
assert expectedCollectionId == collectionId
You can’t perform that action at this time.
0 commit comments