Skip to content

Commit 466343f

Browse files
aarexerphp-coder
authored andcommitted
UsersActivationService.remove(): add unit tests.
Fix #81
1 parent e22962b commit 466343f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,34 @@ class UsersActivationServiceImplTest extends Specification {
181181
1 * jdbcUsersActivationDao.countByActivationKey('0987654321')
182182
}
183183

184+
//
185+
// Tests for remove()
186+
//
187+
188+
def "remove() should throw exception when argument is null"() {
189+
when:
190+
service.remove(null)
191+
then:
192+
thrown IllegalArgumentException
193+
}
194+
195+
def "remove() should throw exception when activation key is null"() {
196+
given:
197+
UsersActivation activation = TestObjects.createUsersActivation()
198+
activation.setActivationKey(null)
199+
when:
200+
service.remove(activation)
201+
then:
202+
thrown IllegalArgumentException
203+
}
204+
205+
def "remove() should pass argument to DAO method"() {
206+
given:
207+
UsersActivation activation = TestObjects.createUsersActivation()
208+
when:
209+
service.remove(activation)
210+
then:
211+
1 * jdbcUsersActivationDao.removeByActivationKey(activation.getActivationKey())
212+
}
213+
184214
}

0 commit comments

Comments
 (0)