Created
April 11, 2020 10:26
-
-
Save 0001vrn/e1807d1ec9818be1a79099d7ca249e85 to your computer and use it in GitHub Desktop.
Revisions
-
0001vrn created this gist
Apr 11, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ class CassandraDbChgRequestRepositoryTest { @Autowired private SpringDataCassandraChgRequestRepository cassandraChgRequestRepository; @Autowired private ChgRequestRepository chgRequestRepository; @AfterEach void tearDown() { cassandraChgRequestRepository.deleteAll(); } @Test void shouldFindAll_ThenReturnChgRequest() { // Arrange var alpha = new AppMetadata("alpha", "1.3.1", "random jira link", "prod-us-west-2", "rolling out new feature"); var alphaChgRequest = new ChgRequest(UUID.randomUUID(), alpha); alphaChgRequest.createChgRequest(alpha); // Act chgRequestRepository.save(alphaChgRequest); // Assert assertNotNull(chgRequestRepository.findAll()); } @Test void shouldFindById_ThenReturnChgRequest() { // Arrange var tango = new AppMetadata("tango", "2.3.1", "random jira link", "prod-us-east-1", "rolling out new feature"); var chgRequest = new ChgRequest(UUID.randomUUID(), tango); chgRequest.createChgRequest(tango); // Act chgRequestRepository.save(chgRequest); var mayBeChgRequest = chgRequestRepository.findById(chgRequest.getId()); // Assert mayBeChgRequest.ifPresent(chgRequestFromDao -> assertEquals(chgRequest.getId(), chgRequestFromDao.getId())); } }