Skip to content

Instantly share code, notes, and snippets.

@marcospereira
Created April 5, 2010 00:06
Show Gist options
  • Save marcospereira/355834 to your computer and use it in GitHub Desktop.
Save marcospereira/355834 to your computer and use it in GitHub Desktop.
application.name=lixo
application.mode=dev
application.secret=veuN1O6Sa4roIvfzxKX6tUCS6xJ4bqkT2R8FLf2vgot8knjTmeqdXuwHIdgRg87C
date.format=dd-MM-yyyy
java.source=1.6
db.url=jdbc:postgresql:lixo_dev
db.driver=org.postgresql.Driver
db.user=postgres
db.pass=postgres
db.pool.timeout=1000
db.pool.maxSize=30
db.pool.minSize=10
jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
jpa.ddl=update
jpa.debugSQL=true
hibernate.use_sql_comments=true
mail.smtp=mock
%test.application.mode=dev
%test.db.url=jdbc:postgresql:lixo_test
%test.db.driver=org.postgresql.Driver
%test.db.user=postgres
%test.db.pass=postgres
%test.jpa.ddl=update
%test.mail.smtp=mock
User(u1):
username: username1
email: [email protected]
password: username1
User(u2):
username: username2
email: [email protected]
password: username2
User(u3):
username: username3
email: [email protected]
password: username3
User(u4):
username: username4
email: [email protected]
password: username4
User(u5):
username: username5
email: [email protected]
password: username5
package models;
import java.util.List;
import org.junit.Test;
import org.junit.Assert;
import org.junit.After;
import org.junit.Before;
import play.test.UnitTest;
import play.test.Fixtures;
public class UserTest extends UnitTest {
@Before
public void loadUsers() {
Fixtures.load("models/users.yml");
}
@Test
public void should_find_user_by_username() {
User user = User.byUsername("username1");
Assert.assertNotNull(user);
Assert.assertEquals("username1", user.username);
}
@Test
public void should_return_null_when_username_is_null() {
Assert.assertNull(User.byUsername(null));
}
@Test
public void should_list_all_users() {
List<User> users = User.all().fetch();
Assert.assertFalse(users.isEmpty());
Assert.assertEquals(5, users.size());
}
@After
public void unloadUser() {
Fixtures.delete(User.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment