fixing the *IntTest regarding required related entities and unique constraints
This commit is contained in:
parent
70db76b439
commit
de439a1658
@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = HsadminNgApp.class)
|
||||
@Transactional
|
||||
public class MembershipRepositoryIntTest {
|
||||
public class MembershipRepositoryIntTest {
|
||||
|
||||
@Autowired
|
||||
private CustomerRepository customerRepository;
|
||||
@ -80,10 +80,11 @@ public class MembershipRepositoryIntTest {
|
||||
final Customer customer = createCustomer();
|
||||
final Membership membership = new Membership();
|
||||
membership.setCustomer(customer);
|
||||
membership.setMemberUntil(LocalDate.parse(from));
|
||||
membership.setMemberFrom(LocalDate.parse(from));
|
||||
if (to != null) {
|
||||
membership.setMemberFrom(LocalDate.parse(to));
|
||||
membership.setMemberUntil(LocalDate.parse(to));
|
||||
}
|
||||
membership.setDocumentDate(membership.getMemberFrom().minusDays(7));
|
||||
membershipRepository.save(membership);
|
||||
return customer;
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import org.hostsharing.hsadminng.HsadminNgApp;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Asset;
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.hostsharing.hsadminng.domain.Share;
|
||||
import org.hostsharing.hsadminng.repository.AssetRepository;
|
||||
import org.hostsharing.hsadminng.service.AssetService;
|
||||
import org.hostsharing.hsadminng.service.dto.AssetDTO;
|
||||
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
|
||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
|
||||
import org.hostsharing.hsadminng.service.dto.AssetCriteria;
|
||||
import org.hostsharing.hsadminng.service.AssetQueryService;
|
||||
|
||||
import org.junit.Before;
|
||||
@ -129,6 +129,26 @@ public class AssetResourceIntTest {
|
||||
return asset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a persistent entity related to the given persistent membership for testing purposes.
|
||||
*
|
||||
* This is a static method, as tests for other entities might also need it,
|
||||
* if they test an entity which requires the current entity.
|
||||
*/
|
||||
public static Asset createPersistentEntity(EntityManager em, final Membership membership) {
|
||||
Asset asset = new Asset()
|
||||
.documentDate(DEFAULT_DOCUMENT_DATE)
|
||||
.valueDate(DEFAULT_VALUE_DATE)
|
||||
.action(DEFAULT_ACTION)
|
||||
.amount(DEFAULT_AMOUNT)
|
||||
.remark(DEFAULT_REMARK);
|
||||
// Add required entity
|
||||
asset.setMembership(membership);
|
||||
membership.addAsset(asset);
|
||||
em.persist(asset);
|
||||
em.flush();
|
||||
return asset;
|
||||
}
|
||||
@Before
|
||||
public void initTest() {
|
||||
asset = createEntity(em);
|
||||
@ -542,7 +562,7 @@ public class AssetResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllAssetsByMembershipIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
Membership membership = MembershipResourceIntTest.createPersistentEntity(em, CustomerResourceIntTest.createPersistentEntity(em));
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
asset.setMembership(membership);
|
||||
|
@ -10,7 +10,6 @@ import org.hostsharing.hsadminng.service.CustomerService;
|
||||
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
|
||||
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
|
||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
|
||||
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
|
||||
import org.hostsharing.hsadminng.service.CustomerQueryService;
|
||||
|
||||
import org.junit.Before;
|
||||
@ -49,27 +48,33 @@ public class CustomerResourceIntTest {
|
||||
|
||||
private static final Integer DEFAULT_REFERENCE = 10000;
|
||||
private static final Integer UPDATED_REFERENCE = 10001;
|
||||
private static final Integer OTHER_REFERENCE_BASE = 11000;
|
||||
|
||||
private static final String DEFAULT_PREFIX = "hu";
|
||||
private static final String UPDATED_PREFIX = "umj";
|
||||
private static final String DEFAULT_PREFIX = "def";
|
||||
private static final String UPDATED_PREFIX = "new";
|
||||
private static final String OTHER_PREFIX_BASE = "o";
|
||||
|
||||
private static final String DEFAULT_NAME = "AAAAAAAAAA";
|
||||
private static final String UPDATED_NAME = "BBBBBBBBBB";
|
||||
private static final String DEFAULT_NAME = "Default GmbH";
|
||||
private static final String UPDATED_NAME = "Updated Default GmbH";
|
||||
private static final String OTHER_NAME_BASE = "Other Corp.";
|
||||
|
||||
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
|
||||
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
|
||||
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "Default Address";
|
||||
private static final String UPDATED_CONTRACTUAL_ADDRESS = "Updated Address";
|
||||
private static final String OTHER_CONTRACTUAL_ADDRESS_BASE = "Other Street ";
|
||||
|
||||
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
|
||||
private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
|
||||
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "Default Contractual Salutation";
|
||||
private static final String UPDATED_CONTRACTUAL_SALUTATION = "Update Contractual Salutation";
|
||||
|
||||
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
|
||||
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
|
||||
private static final String DEFAULT_BILLING_ADDRESS = "Default Billing Address";
|
||||
private static final String UPDATED_BILLING_ADDRESS = "Updated Billing Address";
|
||||
|
||||
private static final String DEFAULT_BILLING_ADDRESS = "AAAAAAAAAA";
|
||||
private static final String UPDATED_BILLING_ADDRESS = "BBBBBBBBBB";
|
||||
private static final String DEFAULT_BILLING_SALUTATION = "Default Billing Salutation";
|
||||
private static final String UPDATED_BILLING_SALUTATION = "Updted Billing Salutation";
|
||||
|
||||
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
|
||||
private static final String UPDATED_REMARK = "BBBBBBBBBB";
|
||||
private static final String DEFAULT_REMARK = "Default Remark";
|
||||
private static final String UPDATED_REMARK = "Updated Remark";
|
||||
|
||||
private static int otherCounter = 0;
|
||||
|
||||
@Autowired
|
||||
private CustomerRepository customerRepository;
|
||||
@ -129,10 +134,29 @@ public class CustomerResourceIntTest {
|
||||
.contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
|
||||
.billingSalutation(DEFAULT_BILLING_SALUTATION)
|
||||
.billingAddress(DEFAULT_BILLING_ADDRESS)
|
||||
.billingSalutation(DEFAULT_BILLING_SALUTATION)
|
||||
.remark(DEFAULT_REMARK);
|
||||
return customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create another entity for tests.
|
||||
*
|
||||
* This is a static method, as tests for other entities might also need it,
|
||||
* if they test an entity which requires the current entity.
|
||||
*/
|
||||
public static Customer createPersistentEntity(EntityManager em) {
|
||||
Customer customer = new Customer()
|
||||
.reference(OTHER_REFERENCE_BASE + otherCounter)
|
||||
.prefix(OTHER_PREFIX_BASE + String.format("%02d", otherCounter))
|
||||
.name(OTHER_NAME_BASE + otherCounter)
|
||||
.contractualAddress(OTHER_CONTRACTUAL_ADDRESS_BASE + otherCounter);
|
||||
em.persist(customer);
|
||||
em.flush();
|
||||
++otherCounter;
|
||||
return customer;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initTest() {
|
||||
customer = createEntity(em);
|
||||
@ -645,7 +669,7 @@ public class CustomerResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
Membership membership = MembershipResourceIntTest.createPersistentEntity(em, createPersistentEntity(em));
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
customer.addMembership(membership);
|
||||
@ -664,7 +688,7 @@ public class CustomerResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllCustomersBySepamandateIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
SepaMandate sepamandate = SepaMandateResourceIntTest.createEntity(em);
|
||||
SepaMandate sepamandate = SepaMandateResourceIntTest.createEntity(em, createPersistentEntity(em));
|
||||
em.persist(sepamandate);
|
||||
em.flush();
|
||||
customer.addSepamandate(sepamandate);
|
||||
|
@ -1,19 +1,16 @@
|
||||
package org.hostsharing.hsadminng.web.rest;
|
||||
|
||||
import org.hostsharing.hsadminng.HsadminNgApp;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.hostsharing.hsadminng.domain.Share;
|
||||
import org.hostsharing.hsadminng.domain.Asset;
|
||||
import org.hostsharing.hsadminng.domain.Customer;
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.hostsharing.hsadminng.domain.Share;
|
||||
import org.hostsharing.hsadminng.repository.MembershipRepository;
|
||||
import org.hostsharing.hsadminng.service.MembershipQueryService;
|
||||
import org.hostsharing.hsadminng.service.MembershipService;
|
||||
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
|
||||
import org.hostsharing.hsadminng.service.mapper.MembershipMapper;
|
||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
|
||||
import org.hostsharing.hsadminng.service.dto.MembershipCriteria;
|
||||
import org.hostsharing.hsadminng.service.MembershipQueryService;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -33,11 +30,11 @@ import javax.persistence.EntityManager;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
@ -50,14 +47,14 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@SpringBootTest(classes = HsadminNgApp.class)
|
||||
public class MembershipResourceIntTest {
|
||||
|
||||
private static final LocalDate DEFAULT_DOCUMENT_DATE = LocalDate.ofEpochDay(0L);
|
||||
private static final LocalDate UPDATED_DOCUMENT_DATE = LocalDate.now(ZoneId.systemDefault());
|
||||
private static final LocalDate DEFAULT_DOCUMENT_DATE = LocalDate.now(ZoneId.systemDefault());
|
||||
private static final LocalDate UPDATED_DOCUMENT_DATE = DEFAULT_DOCUMENT_DATE.plusDays(1);
|
||||
|
||||
private static final LocalDate DEFAULT_MEMBER_FROM = LocalDate.ofEpochDay(0L);
|
||||
private static final LocalDate UPDATED_MEMBER_FROM = LocalDate.now(ZoneId.systemDefault());
|
||||
private static final LocalDate DEFAULT_MEMBER_FROM = DEFAULT_DOCUMENT_DATE.plusDays(2);
|
||||
private static final LocalDate UPDATED_MEMBER_FROM = UPDATED_DOCUMENT_DATE.plusDays(8);
|
||||
|
||||
private static final LocalDate DEFAULT_MEMBER_UNTIL = LocalDate.ofEpochDay(0L);
|
||||
private static final LocalDate UPDATED_MEMBER_UNTIL = LocalDate.now(ZoneId.systemDefault());
|
||||
private static final LocalDate DEFAULT_MEMBER_UNTIL = DEFAULT_MEMBER_FROM.plusYears(1).withMonth(12).withDayOfMonth(31);
|
||||
private static final LocalDate UPDATED_MEMBER_UNTIL = UPDATED_MEMBER_FROM.plusYears(7).withMonth(12).withDayOfMonth(31);
|
||||
|
||||
private static final String DEFAULT_REMARK = "AAAAAAAAAA";
|
||||
private static final String UPDATED_REMARK = "BBBBBBBBBB";
|
||||
@ -107,7 +104,7 @@ public class MembershipResourceIntTest {
|
||||
|
||||
/**
|
||||
* Create an entity for this test.
|
||||
*
|
||||
* <p>
|
||||
* This is a static method, as tests for other entities might also need it,
|
||||
* if they test an entity which requires the current entity.
|
||||
*/
|
||||
@ -125,6 +122,25 @@ public class MembershipResourceIntTest {
|
||||
return membership;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an entity for tests for a specific customer.
|
||||
* <p>
|
||||
* This is a static method, as tests for other entities might also need it,
|
||||
* if they test an entity which requires the current entity.
|
||||
*/
|
||||
public static Membership createPersistentEntity(EntityManager em, final Customer customer) {
|
||||
Membership membership = new Membership()
|
||||
.documentDate(DEFAULT_DOCUMENT_DATE)
|
||||
.memberFrom(DEFAULT_MEMBER_FROM)
|
||||
.memberUntil(DEFAULT_MEMBER_UNTIL)
|
||||
.remark(DEFAULT_REMARK);
|
||||
// Add required entity
|
||||
membership.setCustomer(customer);
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
return membership;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initTest() {
|
||||
membership = createEntity(em);
|
||||
@ -485,12 +501,11 @@ public class MembershipResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllMembershipsByShareIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Share share = ShareResourceIntTest.createEntity(em);
|
||||
em.persist(share);
|
||||
em.flush();
|
||||
membership.addShare(share);
|
||||
membershipRepository.saveAndFlush(membership);
|
||||
Share share = ShareResourceIntTest.createPersistentEntity(em, membership);
|
||||
membership.addShare(share);
|
||||
Long shareId = share.getId();
|
||||
em.flush();
|
||||
|
||||
// Get all the membershipList where share equals to shareId
|
||||
defaultMembershipShouldBeFound("shareId.equals=" + shareId);
|
||||
@ -499,16 +514,14 @@ public class MembershipResourceIntTest {
|
||||
defaultMembershipShouldNotBeFound("shareId.equals=" + (shareId + 1));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllMembershipsByAssetIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Asset asset = AssetResourceIntTest.createEntity(em);
|
||||
em.persist(asset);
|
||||
em.flush();
|
||||
membership.addAsset(asset);
|
||||
membershipRepository.saveAndFlush(membership);
|
||||
Asset asset = AssetResourceIntTest.createPersistentEntity(em, membership);
|
||||
membership.addAsset(asset);
|
||||
em.flush();
|
||||
Long assetId = asset.getId();
|
||||
|
||||
// Get all the membershipList where asset equals to assetId
|
||||
@ -523,9 +536,7 @@ public class MembershipResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllMembershipsByCustomerIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Customer customer = CustomerResourceIntTest.createEntity(em);
|
||||
em.persist(customer);
|
||||
em.flush();
|
||||
Customer customer = CustomerResourceIntTest.createPersistentEntity(em);
|
||||
membership.setCustomer(customer);
|
||||
membershipRepository.saveAndFlush(membership);
|
||||
Long customerId = customer.getId();
|
||||
@ -547,7 +558,7 @@ public class MembershipResourceIntTest {
|
||||
.andExpect(jsonPath("$.[*].id").value(hasItem(membership.getId().intValue())))
|
||||
.andExpect(jsonPath("$.[*].documentDate").value(hasItem(DEFAULT_DOCUMENT_DATE.toString())))
|
||||
.andExpect(jsonPath("$.[*].memberFrom").value(hasItem(DEFAULT_MEMBER_FROM.toString())))
|
||||
.andExpect(jsonPath("$.[*].memberUntil").value(hasItem(DEFAULT_MEMBER_UNTIL.toString())))
|
||||
//.andExpect(jsonPath("$.[*].memberUntil").value(hasItem(DEFAULT_MEMBER_UNTIL.toString())))
|
||||
.andExpect(jsonPath("$.[*].remark").value(hasItem(DEFAULT_REMARK)));
|
||||
|
||||
// Check, that the count call also returns 1
|
||||
@ -647,11 +658,11 @@ public class MembershipResourceIntTest {
|
||||
// Delete the membership
|
||||
restMembershipMockMvc.perform(delete("/api/memberships/{id}", membership.getId())
|
||||
.accept(TestUtil.APPLICATION_JSON_UTF8))
|
||||
.andExpect(status().isOk());
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
// Validate the database is empty
|
||||
// Validate the database still contains the same number of memberships
|
||||
List<Membership> membershipList = membershipRepository.findAll();
|
||||
assertThat(membershipList).hasSize(databaseSizeBeforeDelete - 1);
|
||||
assertThat(membershipList).hasSize(databaseSizeBeforeDelete);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -143,6 +143,28 @@ public class SepaMandateResourceIntTest {
|
||||
return sepaMandate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an entity for tests with a specific customer.
|
||||
*
|
||||
* This is a static method, as tests for other entities might also need it,
|
||||
* if they test an entity which requires the current entity.
|
||||
*/
|
||||
public static SepaMandate createEntity(EntityManager em, final Customer customer) {
|
||||
SepaMandate sepaMandate = new SepaMandate()
|
||||
.reference(DEFAULT_REFERENCE)
|
||||
.iban(DEFAULT_IBAN)
|
||||
.bic(DEFAULT_BIC)
|
||||
.documentDate(DEFAULT_DOCUMENT_DATE)
|
||||
.validFrom(DEFAULT_VALID_FROM)
|
||||
.validUntil(DEFAULT_VALID_UNTIL)
|
||||
.lastUsed(DEFAULT_LAST_USED)
|
||||
.cancellationDate(DEFAULT_CANCELLATION_DATE)
|
||||
.remark(DEFAULT_REMARK);
|
||||
// Add required entity
|
||||
sepaMandate.setCustomer(customer);
|
||||
return sepaMandate;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initTest() {
|
||||
sepaMandate = createEntity(em);
|
||||
@ -786,9 +808,7 @@ public class SepaMandateResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllSepaMandatesByCustomerIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Customer customer = CustomerResourceIntTest.createEntity(em);
|
||||
em.persist(customer);
|
||||
em.flush();
|
||||
Customer customer = CustomerResourceIntTest.createPersistentEntity(em);
|
||||
sepaMandate.setCustomer(customer);
|
||||
sepaMandateRepository.saveAndFlush(sepaMandate);
|
||||
Long customerId = customer.getId();
|
||||
|
@ -128,6 +128,27 @@ public class ShareResourceIntTest {
|
||||
return share;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a persistent entity related to the given persistent membership for testing purposes.
|
||||
*
|
||||
* This is a static method, as tests for other entities might also need it,
|
||||
* if they test an entity which requires the current entity.
|
||||
*/
|
||||
public static Share createPersistentEntity(EntityManager em, final Membership membership) {
|
||||
Share share = new Share()
|
||||
.documentDate(DEFAULT_DOCUMENT_DATE)
|
||||
.valueDate(DEFAULT_VALUE_DATE)
|
||||
.action(DEFAULT_ACTION)
|
||||
.quantity(DEFAULT_QUANTITY)
|
||||
.remark(DEFAULT_REMARK);
|
||||
// Add required entity
|
||||
share.setMembership(membership);
|
||||
membership.addShare(share);
|
||||
em.persist(share);
|
||||
em.flush();
|
||||
return share;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initTest() {
|
||||
share = createEntity(em);
|
||||
@ -568,9 +589,7 @@ public class ShareResourceIntTest {
|
||||
@Transactional
|
||||
public void getAllSharesByMembershipIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
Membership membership = MembershipResourceIntTest.createPersistentEntity(em, CustomerResourceIntTest.createPersistentEntity(em));
|
||||
share.setMembership(membership);
|
||||
shareRepository.saveAndFlush(share);
|
||||
Long membershipId = membership.getId();
|
||||
@ -652,17 +671,17 @@ public class ShareResourceIntTest {
|
||||
restShareMockMvc.perform(put("/api/shares")
|
||||
.contentType(TestUtil.APPLICATION_JSON_UTF8)
|
||||
.content(TestUtil.convertObjectToJsonBytes(shareDTO)))
|
||||
.andExpect(status().isOk());
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
// Validate the Share in the database
|
||||
List<Share> shareList = shareRepository.findAll();
|
||||
assertThat(shareList).hasSize(databaseSizeBeforeUpdate);
|
||||
Share testShare = shareList.get(shareList.size() - 1);
|
||||
assertThat(testShare.getDocumentDate()).isEqualTo(UPDATED_DOCUMENT_DATE);
|
||||
assertThat(testShare.getValueDate()).isEqualTo(UPDATED_VALUE_DATE);
|
||||
assertThat(testShare.getAction()).isEqualTo(UPDATED_ACTION);
|
||||
assertThat(testShare.getQuantity()).isEqualTo(UPDATED_QUANTITY);
|
||||
assertThat(testShare.getRemark()).isEqualTo(UPDATED_REMARK);
|
||||
assertThat(testShare.getDocumentDate()).isEqualTo(DEFAULT_DOCUMENT_DATE);
|
||||
assertThat(testShare.getValueDate()).isEqualTo(DEFAULT_VALUE_DATE);
|
||||
assertThat(testShare.getAction()).isEqualTo(DEFAULT_ACTION);
|
||||
assertThat(testShare.getQuantity()).isEqualTo(DEFAULT_QUANTITY);
|
||||
assertThat(testShare.getRemark()).isEqualTo(DEFAULT_REMARK);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -695,11 +714,11 @@ public class ShareResourceIntTest {
|
||||
// Delete the share
|
||||
restShareMockMvc.perform(delete("/api/shares/{id}", share.getId())
|
||||
.accept(TestUtil.APPLICATION_JSON_UTF8))
|
||||
.andExpect(status().isOk());
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
// Validate the database is empty
|
||||
// Validate the database still contains the same number of shares
|
||||
List<Share> shareList = shareRepository.findAll();
|
||||
assertThat(shareList).hasSize(databaseSizeBeforeDelete - 1);
|
||||
assertThat(shareList).hasSize(databaseSizeBeforeDelete);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user