-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
package com.sample.dao; | ||
|
||
import com.sample.dao.UserDao; | ||
import com.sample.domain.EntityNotFoundException; | ||
import com.sample.domain.User; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.util.Collection; | ||
import java.util.Iterator; | ||
import java.util.Random; | ||
import java.util.UUID; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotEquals; | ||
|
@@ -95,7 +98,7 @@ public void testAddUser() throws Exception { | |
*/ | ||
@Test(expected = IllegalArgumentException.class) | ||
public void testAddUserTwice() throws Exception { | ||
dao.addUser(buildUser( "B", "[email protected]", new String[]{"B"}, "B")); | ||
dao.addUser(buildUser("B", "[email protected]", new String[]{"B"}, "B")); | ||
} | ||
|
||
/** | ||
|
@@ -128,8 +131,23 @@ public void testUpdate() throws Exception { | |
User update = dao.update(user); | ||
System.out.println("update.getVersion() = " + update.getVersion()); | ||
// assertEquals( version, update.getVersion() ); | ||
assertEquals( "[email protected]", update.getEmail() ); | ||
assertEquals("[email protected]", update.getEmail()); | ||
} | ||
|
||
/** | ||
* Method: User getUser(String username) throws EntityNotFoundException | ||
*/ | ||
@Test(expected = EntityNotFoundException.class) | ||
public void testGetUserByNameEntityNotFoundException () throws Exception { | ||
User user = dao.getUser(UUID.randomUUID().toString()); | ||
} | ||
|
||
/** | ||
* Method: User getUser(Long id) throws EntityNotFoundException | ||
*/ | ||
@Test(expected = EntityNotFoundException.class) | ||
public void testGetUserByIdEntityNotFoundException() throws Exception { | ||
User user = dao.getUser(Long.MAX_VALUE); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters