Skip to content

Error when running tests with fixture in IntelliJ #1556

@xael-fry

Description

@xael-fry

Play Version

1.11.0

Describe the bug

running test from intellij alway fails if it contains Fixtures with error

09:05:08.340 [main] DEBUG org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl - Initiating JDBC connection release from afterTransaction
09:05:08.341 [main] DEBUG org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl - Initiating JDBC connection release from afterTransaction

play.exceptions.DatabaseException: No active EntityManager for name [default], transaction not started?

	at play.db.DB.getConnection(DB.java:195)
	at play.db.DB.execute(DB.java:216)
	at play.db.DB.execute(DB.java:237)
	at play.test.Fixtures.disableForeignKeyConstraints(Fixtures.java:640)
	at play.test.Fixtures.deleteAllModels(Fixtures.java:133)
	at BasicTest.countObjects(BasicTest.java:24)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

To Reproduce

public class BasicTest extends UnitTest {

    @Test
    public void countObjects() {
        Fixtures.deleteAllModels();
        Fixtures.loadModels("data.yml");
        assertEquals(2, Post.count());
    }

Expected behavior

Should be run the test

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions