trying to find reason for failing tests in Jenkins, locally all tests are green

This commit is contained in:
Michael Hoennig 2019-04-26 22:53:32 +02:00
parent d81b71cd3a
commit 318ecd0be4
1 changed files with 17 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import org.hostsharing.hsadminng.repository.AssetRepository;
import org.hostsharing.hsadminng.service.AssetQueryService;
import org.hostsharing.hsadminng.service.AssetService;
import org.hostsharing.hsadminng.service.CustomerService;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
@ -60,6 +61,9 @@ public class AssetResourceIntTest {
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
private static final String UPDATED_REMARK = "BBBBBBBBBB";
@Autowired
private CustomerService customerService;
@Autowired
private AssetRepository assetRepository;
@ -120,6 +124,7 @@ public class AssetResourceIntTest {
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
asset.setMembership(membership);
return asset;
}
@ -144,9 +149,13 @@ public class AssetResourceIntTest {
em.flush();
return asset;
}
@Before
public void initTest() {
asset = createEntity(em);
// TOOD: on Jenkins the customer row vanishes, locally all tests are green
assertThat(customerService.findOne(asset.getMembership().getCustomer().getId())).as("precondition failed").isNotNull();
}
@Test
@ -311,10 +320,15 @@ public class AssetResourceIntTest {
assetRepository.saveAndFlush(asset);
// Get all the assetList where documentDate equals to DEFAULT_DOCUMENT_DATE
defaultAssetShouldBeFound("documentDate.equals=" + DEFAULT_DOCUMENT_DATE);
try {
defaultAssetShouldBeFound("documentDate.equals=" + DEFAULT_DOCUMENT_DATE);
// Get all the assetList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultAssetShouldNotBeFound("documentDate.equals=" + UPDATED_DOCUMENT_DATE);
// Get all the assetList where documentDate equals to UPDATED_DOCUMENT_DATE
defaultAssetShouldNotBeFound("documentDate.equals=" + UPDATED_DOCUMENT_DATE);
} catch (Exception exc) {
// TOOD: on Jenkins the customer row vanishes, locally all tests are green
assertThat(customerService.findOne(asset.getMembership().getCustomer().getId())).as("postcondition failed").isNotNull();
}
}
@Test