Skip to content

Commit

Permalink
ADD: testcase for showing an issue with deleting and re-adding many-t…
Browse files Browse the repository at this point in the history
…o-many elements (size > 20)

(cherry picked from commit e6a4bc4)
  • Loading branch information
jonasPoehler committed Jun 16, 2023
1 parent 53b1e4d commit 09f616a
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion ebean-test/src/test/java/org/tests/m2m/TestM2MModifyTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.tests.m2m;

import io.ebean.xtest.BaseTestCase;
import io.ebean.DB;
import io.ebean.xtest.BaseTestCase;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.MRole;
import org.tests.model.basic.MUser;

import java.util.ArrayList;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -52,4 +53,27 @@ public void test() {
roles = u0.getRoles();
assertThat(roles).hasSize(1);
}

@Test
public void test1() {
List<MRole> roles = new ArrayList<>();
for (int i = 0; i < 56; i++) {
MRole r0 = new MRole("mrole" + i);
roles.add(r0);
}

DB.saveAll(roles);

MUser u0 = new MUser("usr0");
u0.getRoles().addAll(roles);

DB.save(u0);

u0 = DB.find(MUser.class, u0.getUserid());

u0.getRoles().clear();
u0.getRoles().addAll(roles);

DB.save(u0);
}
}

0 comments on commit 09f616a

Please sign in to comment.