Skip to content

Commit a798f41

Browse files
committed
CollectionServiceImpl: rename a member.
No functional changes.
1 parent 33a7067 commit a798f41

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/main/java/ru/mystamps/web/service/CollectionServiceImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public class CollectionServiceImpl implements CollectionService {
3939
private static final Logger LOG = LoggerFactory.getLogger(CollectionServiceImpl.class);
4040

41-
private final JdbcCollectionDao jdbcCollectionDao;
41+
private final JdbcCollectionDao collectionDao;
4242

4343
@Override
4444
@Transactional
@@ -52,7 +52,7 @@ public void createCollection(User user) {
5252
Validate.isTrue(slug != null, "Slug for string '%s' is null", user.getLogin());
5353
collection.setSlug(slug);
5454

55-
Integer id = jdbcCollectionDao.add(collection);
55+
Integer id = collectionDao.add(collection);
5656

5757
LOG.info("Collection #{} has been created ({})", id, collection);
5858
}
@@ -64,10 +64,10 @@ public UrlEntityDto addToCollection(Integer userId, Integer seriesId) {
6464
Validate.isTrue(userId != null, "User id must be non null");
6565
Validate.isTrue(seriesId != null, "Series id must be non null");
6666

67-
UrlEntityDto url = jdbcCollectionDao.findCollectionUrlEntityByUserId(userId);
67+
UrlEntityDto url = collectionDao.findCollectionUrlEntityByUserId(userId);
6868
Integer collectionId = url.getId();
6969

70-
jdbcCollectionDao.addSeriesToCollection(collectionId, seriesId);
70+
collectionDao.addSeriesToCollection(collectionId, seriesId);
7171

7272
LOG.info(
7373
"Series #{} has been added to collection #{} of user #{}",
@@ -86,10 +86,10 @@ public UrlEntityDto removeFromCollection(Integer userId, Integer seriesId) {
8686
Validate.isTrue(userId != null, "User id must be non null");
8787
Validate.isTrue(seriesId != null, "Series id must be non null");
8888

89-
UrlEntityDto url = jdbcCollectionDao.findCollectionUrlEntityByUserId(userId);
89+
UrlEntityDto url = collectionDao.findCollectionUrlEntityByUserId(userId);
9090
Integer collectionId = url.getId();
9191

92-
jdbcCollectionDao.removeSeriesFromCollection(collectionId, seriesId);
92+
collectionDao.removeSeriesFromCollection(collectionId, seriesId);
9393

9494
LOG.info(
9595
"Series #{} has been removed from collection of user #{}",
@@ -110,7 +110,7 @@ public boolean isSeriesInCollection(Integer userId, Integer seriesId) {
110110
return false;
111111
}
112112

113-
boolean isSeriesInCollection = jdbcCollectionDao.isSeriesInUserCollection(userId, seriesId);
113+
boolean isSeriesInCollection = collectionDao.isSeriesInUserCollection(userId, seriesId);
114114

115115
LOG.debug(
116116
"Series #{} belongs to collection of user #{}: {}",
@@ -125,15 +125,15 @@ public boolean isSeriesInCollection(Integer userId, Integer seriesId) {
125125
@Override
126126
@Transactional(readOnly = true)
127127
public long countCollectionsOfUsers() {
128-
return jdbcCollectionDao.countCollectionsOfUsers();
128+
return collectionDao.countCollectionsOfUsers();
129129
}
130130

131131
@Override
132132
@Transactional(readOnly = true)
133133
public Iterable<LinkEntityDto> findRecentlyCreated(int quantity) {
134134
Validate.isTrue(quantity > 0, "Quantity must be greater than 0");
135135

136-
return jdbcCollectionDao.findLastCreated(quantity);
136+
return collectionDao.findLastCreated(quantity);
137137
}
138138

139139
}

src/test/groovy/ru/mystamps/web/service/CollectionServiceImplTest.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ import spock.lang.Unroll
2323
import ru.mystamps.web.dao.JdbcCollectionDao
2424

2525
class CollectionServiceImplTest extends Specification {
26-
private JdbcCollectionDao jdbcCollectionDao = Mock()
26+
private JdbcCollectionDao collectionDao = Mock()
2727

2828
private CollectionService service
2929

3030
def setup() {
31-
service = new CollectionServiceImpl(jdbcCollectionDao)
31+
service = new CollectionServiceImpl(collectionDao)
3232
}
3333

3434
//
@@ -53,7 +53,7 @@ class CollectionServiceImplTest extends Specification {
5353
when:
5454
service.findRecentlyCreated(expectedQuantity)
5555
then:
56-
1 * jdbcCollectionDao.findLastCreated({ int quantity ->
56+
1 * collectionDao.findLastCreated({ int quantity ->
5757
assert expectedQuantity == quantity
5858
return true
5959
}) >> []

0 commit comments

Comments
 (0)