Пример #1
0
 @Test
 public void testFindByVendor() {
   // When
   List<Product> products = productDao.findByVendor(201L);
   // Then
   Product expectedProduct = new Product();
   expectedProduct.setId(209L);
   Product expectedProduct1 = new Product();
   expectedProduct1.setId(210L);
   assertThat(products).isEqualTo(Arrays.asList(expectedProduct, expectedProduct1));
 }
Пример #2
0
 @Test
 public void testFindByYandexId() {
   // When
   List<Product> products = productDao.findByYandexId("10495459");
   // Then
   Product expectedProduct = new Product();
   expectedProduct.setId(200L);
   Product expectedProduct1 = new Product();
   expectedProduct1.setId(201L);
   assertThat(products).isEqualTo(Arrays.asList(expectedProduct, expectedProduct1));
 }
Пример #3
0
  @Test
  public void testFindActiveByVendorOrderByVendorAndName() {
    // When
    List<Product> products =
        productDao.findActiveByVendorOrderByVendorAndName(200, Arrays.asList(200L, 201L));

    // Then
    Product expectedProduct = new Product();
    expectedProduct.setId(206L);
    Product expectedProduct1 = new Product();
    expectedProduct1.setId(205L);
    Product expectedProduct2 = new Product();
    expectedProduct2.setId(204L);
    Product expectedProduct3 = new Product();
    expectedProduct3.setId(203L);

    assertThat(products)
        .isEqualTo(
            Arrays.asList(expectedProduct, expectedProduct1, expectedProduct2, expectedProduct3));
  }