这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,4 @@ public void setIsbn(String isbn) {
this.isbn = isbn;
}


@Version
private Long version;

public Long getVersion() {
return version;
}

public void setVersion(Long version) {
this.version = version;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import com.baeldung.recordswithjpa.records.BookRecord;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class QueryServiceIntegrationTest extends RecordsAsJpaIntegrationTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@

import com.baeldung.recordswithjpa.entity.Book;
import com.baeldung.recordswithjpa.repository.BookRepository;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import jakarta.transaction.Transactional;

@Transactional
@SpringBootTest
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class RecordsAsJpaIntegrationTest {
@Autowired
protected BookRepository bookRepository;

@BeforeEach
@BeforeAll
void setUp() {

Book book = new Book(null,"The Lord of the Rings", "J.R.R. Tolkien", "978-0544003415");
Expand All @@ -28,7 +31,7 @@ void setUp() {
bookRepository.save(book3);
}

@AfterEach
@AfterAll
void tearDown() {
bookRepository.deleteAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import com.baeldung.recordswithjpa.RecordsAsJpaIntegrationTest;
import org.junit.jupiter.api.Test;
import org.springframework.test.annotation.DirtiesContext;

import static org.junit.jupiter.api.Assertions.*;

@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
class BookRepositoryIntegrationTest extends RecordsAsJpaIntegrationTest {

@Test
Expand Down