Created
August 22, 2017 23:01
-
-
Save lhauspie/8da1cb8c5f8c3b72ba4009c1653f6da3 to your computer and use it in GitHub Desktop.
Test d’intégration du Custom Repository produit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootTest | |
@RunWith(SpringRunner.class) | |
public class ProductRepositoryIntegrationTest { | |
@Autowired | |
private ProductRepository productRepo; | |
@Autowired | |
private MongoTemplate mongoTemplate; | |
@Test | |
public void searchProductTest() { | |
// partie init de données | |
Assertions.assertThat(productRepo.findAll()).hasSize(0); | |
Product product = productRepo.save(new Product(null, "CODE", "LABEL", "DESCRIPTION", 1234D)); | |
// appel de la couche Repository à tester | |
Collection<Product> products = productRepo.search(new SearchQuery("CODE", null, null, null, null)); | |
// partie verification de l'execution | |
Assertions.assertThat(products).hasSize(1); | |
Assertions.assertThat(products).containsExactly(product); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment