コード例 #1
0
 @Before
 public void initTest() {
   os_type = new Os_type();
   os_type.setOs_type_name(DEFAULT_OS_TYPE_NAME);
   os_type.setDescription(DEFAULT_DESCRIPTION);
   os_type.setStatus_id(DEFAULT_STATUS_ID);
   os_type.setCreated_by(DEFAULT_CREATED_BY);
   os_type.setCreated_date(DEFAULT_CREATED_DATE);
   os_type.setModified_by(DEFAULT_MODIFIED_BY);
   os_type.setModified_date(DEFAULT_MODIFIED_DATE);
 }
コード例 #2
0
  @Test
  @Transactional
  public void checkDescriptionIsRequired() throws Exception {
    int databaseSizeBeforeTest = os_typeRepository.findAll().size();
    // set the field null
    os_type.setDescription(null);

    // Create the Os_type, which fails.

    restOs_typeMockMvc
        .perform(
            post("/api/os_types")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(os_type)))
        .andExpect(status().isBadRequest());

    List<Os_type> os_types = os_typeRepository.findAll();
    assertThat(os_types).hasSize(databaseSizeBeforeTest);
  }
コード例 #3
0
  @Test
  @Transactional
  public void updateOs_type() throws Exception {
    // Initialize the database
    os_typeRepository.saveAndFlush(os_type);

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

    // Update the os_type
    os_type.setOs_type_name(UPDATED_OS_TYPE_NAME);
    os_type.setDescription(UPDATED_DESCRIPTION);
    os_type.setStatus_id(UPDATED_STATUS_ID);
    os_type.setCreated_by(UPDATED_CREATED_BY);
    os_type.setCreated_date(UPDATED_CREATED_DATE);
    os_type.setModified_by(UPDATED_MODIFIED_BY);
    os_type.setModified_date(UPDATED_MODIFIED_DATE);

    restOs_typeMockMvc
        .perform(
            put("/api/os_types")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(os_type)))
        .andExpect(status().isOk());

    // Validate the Os_type in the database
    List<Os_type> os_types = os_typeRepository.findAll();
    assertThat(os_types).hasSize(databaseSizeBeforeUpdate);
    Os_type testOs_type = os_types.get(os_types.size() - 1);
    assertThat(testOs_type.getOs_type_name()).isEqualTo(UPDATED_OS_TYPE_NAME);
    assertThat(testOs_type.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testOs_type.getStatus_id()).isEqualTo(UPDATED_STATUS_ID);
    assertThat(testOs_type.getCreated_by()).isEqualTo(UPDATED_CREATED_BY);
    assertThat(testOs_type.getCreated_date()).isEqualTo(UPDATED_CREATED_DATE);
    assertThat(testOs_type.getModified_by()).isEqualTo(UPDATED_MODIFIED_BY);
    assertThat(testOs_type.getModified_date()).isEqualTo(UPDATED_MODIFIED_DATE);
  }