@Test
  @Transactional
  public void updateTableNo() throws Exception {
    // Initialize the database
    tableNoRepository.saveAndFlush(tableNo);

    int databaseSizeBeforeUpdate = tableNoRepository.findAll().size();

    // Update the tableNo
    tableNo.setName(UPDATED_NAME);
    tableNo.setDescription(UPDATED_DESCRIPTION);
    restTableNoMockMvc
        .perform(
            put("/api/tableNos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(tableNo)))
        .andExpect(status().isOk());

    // Validate the TableNo in the database
    List<TableNo> tableNos = tableNoRepository.findAll();
    assertThat(tableNos).hasSize(databaseSizeBeforeUpdate);
    TableNo testTableNo = tableNos.get(tableNos.size() - 1);
    assertThat(testTableNo.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testTableNo.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
  }
  @Test
  @Transactional
  public void getTableNo() throws Exception {
    // Initialize the database
    tableNoRepository.saveAndFlush(tableNo);

    // Get the tableNo
    restTableNoMockMvc
        .perform(get("/api/tableNos/{id}", tableNo.getId()))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.id").value(tableNo.getId().intValue()))
        .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
        .andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()));
  }
  @Test
  @Transactional
  public void createTableNo() throws Exception {
    int databaseSizeBeforeCreate = tableNoRepository.findAll().size();

    // Create the TableNo
    restTableNoMockMvc
        .perform(
            post("/api/tableNos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(tableNo)))
        .andExpect(status().isCreated());

    // Validate the TableNo in the database
    List<TableNo> tableNos = tableNoRepository.findAll();
    assertThat(tableNos).hasSize(databaseSizeBeforeCreate + 1);
    TableNo testTableNo = tableNos.get(tableNos.size() - 1);
    assertThat(testTableNo.getName()).isEqualTo(DEFAULT_NAME);
    assertThat(testTableNo.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
  }
  @Test
  @Transactional
  public void deleteTableNo() throws Exception {
    // Initialize the database
    tableNoRepository.saveAndFlush(tableNo);

    int databaseSizeBeforeDelete = tableNoRepository.findAll().size();

    // Get the tableNo
    restTableNoMockMvc
        .perform(
            delete("/api/tableNos/{id}", tableNo.getId()).accept(TestUtil.APPLICATION_JSON_UTF8))
        .andExpect(status().isOk());

    // Validate the database is empty
    List<TableNo> tableNos = tableNoRepository.findAll();
    assertThat(tableNos).hasSize(databaseSizeBeforeDelete - 1);
  }
  @Test
  @Transactional
  public void checkNameIsRequired() throws Exception {
    // Validate the database is empty
    assertThat(tableNoRepository.findAll()).hasSize(0);
    // set the field null
    tableNo.setName(null);

    // Create the TableNo, which fails.
    restTableNoMockMvc
        .perform(
            post("/api/tableNos")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(tableNo)))
        .andExpect(status().isBadRequest());

    // Validate the database is still empty
    List<TableNo> tableNos = tableNoRepository.findAll();
    assertThat(tableNos).hasSize(0);
  }
 @Before
 public void initTest() {
   tableNo = new TableNo();
   tableNo.setName(DEFAULT_NAME);
   tableNo.setDescription(DEFAULT_DESCRIPTION);
 }