/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
spring-boot-modules/spring-boot-testing-3/src/test/java/com/baeldung/embeddedpostgresql/EmbeddedPostgresLiveTest.java
33 строки
1 KB
Harry9656
JAVA-35559: Supress spring-boot-testing-3 postgres integration test failures (#16796)
09 июн 2024, 16:46
Не верифицирован
09 июн 2024, 16:46
8f0afee
Код
Авторство
О чём код?
package com.baeldung.embeddedpostgresql; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.ContextConfiguration; import com.baeldung.embeddedpostgresql.EmbeddedPostgresConfiguration.EmbeddedPostgresExtension; @DataJpaTest @ExtendWith(EmbeddedPostgresExtension.class) @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) @ContextConfiguration(classes = { EmbeddedPostgresConfiguration.class }) class EmbeddedPostgresLiveTest { @Autowired private PersonRepository repository; @Test void givenEmbeddedPostgres_whenSavePerson_thenSavedEntityShouldBeReturnedWithExpectedFields() { Person person = new Person(); person.setName("New user"); Person savedPerson = repository.save(person); assertNotNull(savedPerson.getId()); assertEquals(person.getName(), savedPerson.getName()); } }