blob: 1ae2cff7f0b903a191cd6c6b92b55d37d6248bea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package org.berzerkula.builddb.repositories;
import org.assertj.core.api.Assertions;
import org.berzerkula.builddb.models.Pkg;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class PkgRepositoryTest {
@Autowired
PkgRepository pkgRepository;
@Test
void testCreateReadDelete() {
Pkg pkg = new Pkg(123, "Test", "1.2.3", "",
"", "", "", "", "");
pkgRepository.save(pkg);
Iterable<Pkg> pkgs = pkgRepository.findAll();
Assertions.assertThat(pkgs).extracting(Pkg::getSequence).containsOnly(123);
pkgRepository.deleteAll();
Assertions.assertThat(pkgRepository.findAll()).isEmpty();
}
}
|