Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package myapp.module1.account
- import org.scalatest.Spec
- import org.scalatest.matchers.ShouldMatchers
- class AccountServiceSpec extends Spec with ShouldMatchers {
- val accountSvc = new AccountServiceImpl()
- it("should create a new account") {
- val username = "tiago"; val password = "secret"
- accountSvc.isUsernameInUse(username) should be (false)
- accountSvc.createAccount(new Account(username: username, password: password))
- accountSvc.isUsernameInUse(username) should be (true)
- }
- it("should not create a new account with blank username") {
- intercept(RuntimeException) {
- accountSvc.createAccount(new Account(username: " ", password: "foo"))
- }
- }
- it("should not create a new account with blank password") {
- intercept(RuntimeException) {
- accountSvc.createAccount(new Account(username: "foo", password: " "))
- }
- }
- it("should not create a new account with blank username and password") {
- intercept(RuntimeException) {
- accountSvc.createAccount(new Account(username: " ", password: " "))
- }
- }
- }
Add Comment
Please, Sign In to add comment