BrandResourceIntTest.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:spring-io 作者:
@Test
@Transactional
public void createBrand() throws Exception {
    int databaseSizeBeforeCreate = brandRepository.findAll().size();

    // Create the Brand
    restBrandMockMvc.perform(post("/api/brands")
        .contentType(TestUtil.APPLICATION_JSON_UTF8)
        .content(TestUtil.convertObjectToJsonBytes(brand)))
        .andExpect(status().isCreated());

    // Validate the Brand in the database
    List<Brand> brandList = brandRepository.findAll();
    assertThat(brandList).hasSize(databaseSizeBeforeCreate + 1);
    Brand testBrand = brandList.get(brandList.size() - 1);
    assertThat(testBrand.getName()).isEqualTo(DEFAULT_NAME);
    assertThat(testBrand.getStartDate()).isEqualTo(DEFAULT_START_DATE);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号