Commit e7014af4 authored by Fjen Undso's avatar Fjen Undso
Browse files

test: fix session id test

parent e7148c15
......@@ -24,7 +24,7 @@ public class Session extends Model {
@Id
@Constraints.MinLength(6)
public Integer id;
public String id;
private final int IDMIN = 100000;
private final int IDMAX = 1000000;
......@@ -69,7 +69,7 @@ public class Session extends Model {
id = rnd.nextInt(IDMAX - IDMIN) + IDMIN;
} while (Session.find.byId(id.toString()) != null);
this.id = id;
this.id = id.toString();
this.owner = owner;
this.name = name;
this.open = true;
......
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import models.QuestionAnswer;
import models.Session;
import models.Vote;
......@@ -110,6 +111,7 @@ public class ModelTest {
Session s2 = new Session("owner1", "Session2");
s1.save();
s2.save();
assertEquals(5, s1.id.length());
assertEquals(6, s1.id.length());
assertNotEquals(s1.id, s2.id);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment