99import org .junit .jupiter .api .DisplayName ;
1010import org .junit .jupiter .api .Test ;
1111import org .springframework .beans .factory .annotation .Autowired ;
12- import org .springframework .boot .test .autoconfigure . orm . jpa . DataJpaTest ;
12+ import org .springframework .boot .test .context . SpringBootTest ;
1313import org .springframework .context .annotation .Import ;
1414import org .springframework .test .context .ActiveProfiles ;
15+ import org .springframework .transaction .annotation .Transactional ;
1516
1617import com .example .log4u .common .config .QueryDslConfig ;
1718import com .example .log4u .domain .media .MediaStatus ;
2122import jakarta .persistence .EntityManager ;
2223import jakarta .persistence .PersistenceContext ;
2324
24- @ DataJpaTest
25- @ ActiveProfiles ("test" )
25+ @ SpringBootTest
2626@ Import (QueryDslConfig .class )
27- public class MediaRepositoryTest {
27+ @ Transactional
28+ @ ActiveProfiles ({"dev" , "dev-secret" })
29+ class MediaRepositoryTest {
2830
2931 @ Autowired
3032 private MediaRepository mediaRepository ;
@@ -38,7 +40,7 @@ public class MediaRepositoryTest {
3840 @ BeforeEach
3941 void setUp () {
4042 mediaRepository .deleteAll ();
41- em .createNativeQuery ("ALTER TABLE media ALTER COLUMN media_id RESTART WITH 1 " ).executeUpdate ();
43+ em .createNativeQuery ("ALTER TABLE Media AUTO_INCREMENT = 1; " ).executeUpdate ();
4244
4345 Media media1 = MediaFixture .createMediaFixture (null , diaryId1 , MediaStatus .PERMANENT , 2 );
4446 Media media2 = MediaFixture .createMediaFixture (null , diaryId1 , MediaStatus .PERMANENT , 0 );
0 commit comments