main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | package com.example.rezevirajmasa.demo;
|
---|
2 |
|
---|
3 | import com.example.rezevirajmasa.demo.model.TableEntity;
|
---|
4 | import com.example.rezevirajmasa.demo.repository.TableRepository;
|
---|
5 | import org.assertj.core.api.Assertions;
|
---|
6 | import org.junit.jupiter.api.Test;
|
---|
7 | import org.springframework.beans.factory.annotation.Autowired;
|
---|
8 | import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
|
---|
9 | import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
---|
10 | import org.springframework.test.annotation.Rollback;
|
---|
11 |
|
---|
12 | @DataJpaTest
|
---|
13 | @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
---|
14 | @Rollback(false)
|
---|
15 | public class TableRepositoryTests {
|
---|
16 | @Autowired private TableRepository tableRepository;
|
---|
17 |
|
---|
18 | @Test
|
---|
19 | public void testAddNew() {
|
---|
20 | TableEntity tableEntity = new TableEntity();
|
---|
21 | tableEntity.setCapacity(2);
|
---|
22 | tableEntity.setDescription("Romantic spot");
|
---|
23 | tableEntity.setSmokingArea(true);
|
---|
24 | tableEntity.setLocation("Big blue");
|
---|
25 |
|
---|
26 | TableEntity savedTable = tableRepository.save(tableEntity);
|
---|
27 | Assertions.assertThat(savedTable).isNotNull();
|
---|
28 | Assertions.assertThat(savedTable.getId()).isGreaterThan(0);
|
---|
29 | }
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.