source: src/test/java/com/example/rezevirajmasa/demo/TableRepositoryTests.java@ b67dfd3

main
Last change on this file since b67dfd3 was b67dfd3, checked in by Aleksandar Panovski <apano77@…>, 12 days ago

Normalization needed to continue, till here done

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.example.rezevirajmasa.demo;
2
3import com.example.rezevirajmasa.demo.model.TableEntity;
4import com.example.rezevirajmasa.demo.repository.TableRepository;
5import org.assertj.core.api.Assertions;
6import org.junit.jupiter.api.Test;
7import org.springframework.beans.factory.annotation.Autowired;
8import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
9import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
10import org.springframework.test.annotation.Rollback;
11
12@DataJpaTest
13@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
14@Rollback(false)
15public 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.setTableLocation("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.