main
Last change
on this file was b67dfd3, checked in by Aleksandar Panovski <apano77@…>, 4 weeks ago |
Normalization needed to continue, till here done
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d24f17c] | 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);
|
---|
[b67dfd3] | 24 | tableEntity.setTableLocation("Big blue");
|
---|
[d24f17c] | 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.