Skip to content

Instantly share code, notes, and snippets.

@turing85
Last active December 12, 2023 13:50
Show Gist options
  • Save turing85/004f6d96e4a68af4007c326e1d8cb3e0 to your computer and use it in GitHub Desktop.
Save turing85/004f6d96e4a68af4007c326e1d8cb3e0 to your computer and use it in GitHub Desktop.
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.spy;
@SpringBootTest
class MyIntegrationTests {
@Autowired
private AbstractEntityManagerFactoryBean entityManagerFactoryBean;
@Test
void myIntegrationTest() {
AbstractEntityManagerFactoryBean emfSpy = spy(entityManagerFactoryBean);
doNothing().when(emfSpy).destroy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment