re-importing latest customer.jdl from master branch
This commit is contained in:
@ -1,17 +1,15 @@
|
||||
package org.hostsharing.hsadminng.web.rest;
|
||||
|
||||
import org.hostsharing.hsadminng.HsadminNgApp;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Asset;
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
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.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;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -33,14 +31,11 @@ import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
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.*;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
|
||||
/**
|
||||
* Test class for the AssetResource REST controller.
|
||||
*
|
||||
@ -117,6 +112,11 @@ public class AssetResourceIntTest {
|
||||
.action(DEFAULT_ACTION)
|
||||
.amount(DEFAULT_AMOUNT)
|
||||
.comment(DEFAULT_COMMENT);
|
||||
// Add required entity
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
asset.setMember(membership);
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
package org.hostsharing.hsadminng.web.rest;
|
||||
|
||||
import org.hostsharing.hsadminng.HsadminNgApp;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Customer;
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.hostsharing.hsadminng.domain.CustomerContact;
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.hostsharing.hsadminng.repository.CustomerRepository;
|
||||
import org.hostsharing.hsadminng.service.CustomerQueryService;
|
||||
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;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -31,10 +28,9 @@ import org.springframework.validation.Validator;
|
||||
import javax.persistence.EntityManager;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
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.*;
|
||||
|
||||
@ -53,6 +49,21 @@ public class CustomerResourceIntTest {
|
||||
private static final String DEFAULT_PREFIX = "lzv";
|
||||
private static final String UPDATED_PREFIX = "zf";
|
||||
|
||||
private static final String DEFAULT_NAME = "AAAAAAAAAA";
|
||||
private static final String UPDATED_NAME = "BBBBBBBBBB";
|
||||
|
||||
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
|
||||
private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
|
||||
|
||||
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
|
||||
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
|
||||
|
||||
private static final String DEFAULT_BILLING_ADDRESS = "AAAAAAAAAA";
|
||||
private static final String UPDATED_BILLING_ADDRESS = "BBBBBBBBBB";
|
||||
|
||||
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
|
||||
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
|
||||
|
||||
@Autowired
|
||||
private CustomerRepository customerRepository;
|
||||
|
||||
@ -105,7 +116,12 @@ public class CustomerResourceIntTest {
|
||||
public static Customer createEntity(EntityManager em) {
|
||||
Customer customer = new Customer()
|
||||
.number(DEFAULT_NUMBER)
|
||||
.prefix(DEFAULT_PREFIX);
|
||||
.prefix(DEFAULT_PREFIX)
|
||||
.name(DEFAULT_NAME)
|
||||
.contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
|
||||
.contractualSalutation(DEFAULT_CONTRACTUAL_SALUTATION)
|
||||
.billingAddress(DEFAULT_BILLING_ADDRESS)
|
||||
.billingSalutation(DEFAULT_BILLING_SALUTATION);
|
||||
return customer;
|
||||
}
|
||||
|
||||
@ -132,6 +148,11 @@ public class CustomerResourceIntTest {
|
||||
Customer testCustomer = customerList.get(customerList.size() - 1);
|
||||
assertThat(testCustomer.getNumber()).isEqualTo(DEFAULT_NUMBER);
|
||||
assertThat(testCustomer.getPrefix()).isEqualTo(DEFAULT_PREFIX);
|
||||
assertThat(testCustomer.getName()).isEqualTo(DEFAULT_NAME);
|
||||
assertThat(testCustomer.getContractualAddress()).isEqualTo(DEFAULT_CONTRACTUAL_ADDRESS);
|
||||
assertThat(testCustomer.getContractualSalutation()).isEqualTo(DEFAULT_CONTRACTUAL_SALUTATION);
|
||||
assertThat(testCustomer.getBillingAddress()).isEqualTo(DEFAULT_BILLING_ADDRESS);
|
||||
assertThat(testCustomer.getBillingSalutation()).isEqualTo(DEFAULT_BILLING_SALUTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -192,6 +213,44 @@ public class CustomerResourceIntTest {
|
||||
assertThat(customerList).hasSize(databaseSizeBeforeTest);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void checkNameIsRequired() throws Exception {
|
||||
int databaseSizeBeforeTest = customerRepository.findAll().size();
|
||||
// set the field null
|
||||
customer.setName(null);
|
||||
|
||||
// Create the Customer, which fails.
|
||||
CustomerDTO customerDTO = customerMapper.toDto(customer);
|
||||
|
||||
restCustomerMockMvc.perform(post("/api/customers")
|
||||
.contentType(TestUtil.APPLICATION_JSON_UTF8)
|
||||
.content(TestUtil.convertObjectToJsonBytes(customerDTO)))
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
List<Customer> customerList = customerRepository.findAll();
|
||||
assertThat(customerList).hasSize(databaseSizeBeforeTest);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void checkContractualAddressIsRequired() throws Exception {
|
||||
int databaseSizeBeforeTest = customerRepository.findAll().size();
|
||||
// set the field null
|
||||
customer.setContractualAddress(null);
|
||||
|
||||
// Create the Customer, which fails.
|
||||
CustomerDTO customerDTO = customerMapper.toDto(customer);
|
||||
|
||||
restCustomerMockMvc.perform(post("/api/customers")
|
||||
.contentType(TestUtil.APPLICATION_JSON_UTF8)
|
||||
.content(TestUtil.convertObjectToJsonBytes(customerDTO)))
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
List<Customer> customerList = customerRepository.findAll();
|
||||
assertThat(customerList).hasSize(databaseSizeBeforeTest);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomers() throws Exception {
|
||||
@ -204,7 +263,12 @@ public class CustomerResourceIntTest {
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
|
||||
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
|
||||
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())));
|
||||
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())))
|
||||
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
|
||||
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS.toString())))
|
||||
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION.toString())))
|
||||
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS.toString())))
|
||||
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION.toString())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -219,7 +283,12 @@ public class CustomerResourceIntTest {
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||
.andExpect(jsonPath("$.id").value(customer.getId().intValue()))
|
||||
.andExpect(jsonPath("$.number").value(DEFAULT_NUMBER))
|
||||
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()));
|
||||
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()))
|
||||
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
|
||||
.andExpect(jsonPath("$.contractualAddress").value(DEFAULT_CONTRACTUAL_ADDRESS.toString()))
|
||||
.andExpect(jsonPath("$.contractualSalutation").value(DEFAULT_CONTRACTUAL_SALUTATION.toString()))
|
||||
.andExpect(jsonPath("$.billingAddress").value(DEFAULT_BILLING_ADDRESS.toString()))
|
||||
.andExpect(jsonPath("$.billingSalutation").value(DEFAULT_BILLING_SALUTATION.toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -329,22 +398,198 @@ public class CustomerResourceIntTest {
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
|
||||
public void getAllCustomersByNameIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
customer.addMembership(membership);
|
||||
customerRepository.saveAndFlush(customer);
|
||||
Long membershipId = membership.getId();
|
||||
|
||||
// Get all the customerList where membership equals to membershipId
|
||||
defaultCustomerShouldBeFound("membershipId.equals=" + membershipId);
|
||||
// Get all the customerList where name equals to DEFAULT_NAME
|
||||
defaultCustomerShouldBeFound("name.equals=" + DEFAULT_NAME);
|
||||
|
||||
// Get all the customerList where membership equals to membershipId + 1
|
||||
defaultCustomerShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
|
||||
// Get all the customerList where name equals to UPDATED_NAME
|
||||
defaultCustomerShouldNotBeFound("name.equals=" + UPDATED_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByNameIsInShouldWork() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where name in DEFAULT_NAME or UPDATED_NAME
|
||||
defaultCustomerShouldBeFound("name.in=" + DEFAULT_NAME + "," + UPDATED_NAME);
|
||||
|
||||
// Get all the customerList where name equals to UPDATED_NAME
|
||||
defaultCustomerShouldNotBeFound("name.in=" + UPDATED_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByNameIsNullOrNotNull() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where name is not null
|
||||
defaultCustomerShouldBeFound("name.specified=true");
|
||||
|
||||
// Get all the customerList where name is null
|
||||
defaultCustomerShouldNotBeFound("name.specified=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS
|
||||
defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS);
|
||||
|
||||
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
|
||||
defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS
|
||||
defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS);
|
||||
|
||||
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
|
||||
defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where contractualAddress is not null
|
||||
defaultCustomerShouldBeFound("contractualAddress.specified=true");
|
||||
|
||||
// Get all the customerList where contractualAddress is null
|
||||
defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByContractualSalutationIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where contractualSalutation equals to DEFAULT_CONTRACTUAL_SALUTATION
|
||||
defaultCustomerShouldBeFound("contractualSalutation.equals=" + DEFAULT_CONTRACTUAL_SALUTATION);
|
||||
|
||||
// Get all the customerList where contractualSalutation equals to UPDATED_CONTRACTUAL_SALUTATION
|
||||
defaultCustomerShouldNotBeFound("contractualSalutation.equals=" + UPDATED_CONTRACTUAL_SALUTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByContractualSalutationIsInShouldWork() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where contractualSalutation in DEFAULT_CONTRACTUAL_SALUTATION or UPDATED_CONTRACTUAL_SALUTATION
|
||||
defaultCustomerShouldBeFound("contractualSalutation.in=" + DEFAULT_CONTRACTUAL_SALUTATION + "," + UPDATED_CONTRACTUAL_SALUTATION);
|
||||
|
||||
// Get all the customerList where contractualSalutation equals to UPDATED_CONTRACTUAL_SALUTATION
|
||||
defaultCustomerShouldNotBeFound("contractualSalutation.in=" + UPDATED_CONTRACTUAL_SALUTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByContractualSalutationIsNullOrNotNull() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where contractualSalutation is not null
|
||||
defaultCustomerShouldBeFound("contractualSalutation.specified=true");
|
||||
|
||||
// Get all the customerList where contractualSalutation is null
|
||||
defaultCustomerShouldNotBeFound("contractualSalutation.specified=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where billingAddress equals to DEFAULT_BILLING_ADDRESS
|
||||
defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS);
|
||||
|
||||
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
|
||||
defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS
|
||||
defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS);
|
||||
|
||||
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
|
||||
defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where billingAddress is not null
|
||||
defaultCustomerShouldBeFound("billingAddress.specified=true");
|
||||
|
||||
// Get all the customerList where billingAddress is null
|
||||
defaultCustomerShouldNotBeFound("billingAddress.specified=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByBillingSalutationIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where billingSalutation equals to DEFAULT_BILLING_SALUTATION
|
||||
defaultCustomerShouldBeFound("billingSalutation.equals=" + DEFAULT_BILLING_SALUTATION);
|
||||
|
||||
// Get all the customerList where billingSalutation equals to UPDATED_BILLING_SALUTATION
|
||||
defaultCustomerShouldNotBeFound("billingSalutation.equals=" + UPDATED_BILLING_SALUTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByBillingSalutationIsInShouldWork() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where billingSalutation in DEFAULT_BILLING_SALUTATION or UPDATED_BILLING_SALUTATION
|
||||
defaultCustomerShouldBeFound("billingSalutation.in=" + DEFAULT_BILLING_SALUTATION + "," + UPDATED_BILLING_SALUTATION);
|
||||
|
||||
// Get all the customerList where billingSalutation equals to UPDATED_BILLING_SALUTATION
|
||||
defaultCustomerShouldNotBeFound("billingSalutation.in=" + UPDATED_BILLING_SALUTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByBillingSalutationIsNullOrNotNull() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where billingSalutation is not null
|
||||
defaultCustomerShouldBeFound("billingSalutation.specified=true");
|
||||
|
||||
// Get all the customerList where billingSalutation is null
|
||||
defaultCustomerShouldNotBeFound("billingSalutation.specified=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@ -364,6 +609,25 @@ public class CustomerResourceIntTest {
|
||||
defaultCustomerShouldNotBeFound("roleId.equals=" + (roleId + 1));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
customer.addMembership(membership);
|
||||
customerRepository.saveAndFlush(customer);
|
||||
Long membershipId = membership.getId();
|
||||
|
||||
// Get all the customerList where membership equals to membershipId
|
||||
defaultCustomerShouldBeFound("membershipId.equals=" + membershipId);
|
||||
|
||||
// Get all the customerList where membership equals to membershipId + 1
|
||||
defaultCustomerShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the search, and checks that the default entity is returned
|
||||
*/
|
||||
@ -373,7 +637,12 @@ public class CustomerResourceIntTest {
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
|
||||
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
|
||||
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
|
||||
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)));
|
||||
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)))
|
||||
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
|
||||
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS)))
|
||||
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION)))
|
||||
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS)))
|
||||
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION)));
|
||||
|
||||
// Check, that the count call also returns 1
|
||||
restCustomerMockMvc.perform(get("/api/customers/count?sort=id,desc&" + filter))
|
||||
@ -422,7 +691,12 @@ public class CustomerResourceIntTest {
|
||||
em.detach(updatedCustomer);
|
||||
updatedCustomer
|
||||
.number(UPDATED_NUMBER)
|
||||
.prefix(UPDATED_PREFIX);
|
||||
.prefix(UPDATED_PREFIX)
|
||||
.name(UPDATED_NAME)
|
||||
.contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
|
||||
.contractualSalutation(UPDATED_CONTRACTUAL_SALUTATION)
|
||||
.billingAddress(UPDATED_BILLING_ADDRESS)
|
||||
.billingSalutation(UPDATED_BILLING_SALUTATION);
|
||||
CustomerDTO customerDTO = customerMapper.toDto(updatedCustomer);
|
||||
|
||||
restCustomerMockMvc.perform(put("/api/customers")
|
||||
@ -436,6 +710,11 @@ public class CustomerResourceIntTest {
|
||||
Customer testCustomer = customerList.get(customerList.size() - 1);
|
||||
assertThat(testCustomer.getNumber()).isEqualTo(UPDATED_NUMBER);
|
||||
assertThat(testCustomer.getPrefix()).isEqualTo(UPDATED_PREFIX);
|
||||
assertThat(testCustomer.getName()).isEqualTo(UPDATED_NAME);
|
||||
assertThat(testCustomer.getContractualAddress()).isEqualTo(UPDATED_CONTRACTUAL_ADDRESS);
|
||||
assertThat(testCustomer.getContractualSalutation()).isEqualTo(UPDATED_CONTRACTUAL_SALUTATION);
|
||||
assertThat(testCustomer.getBillingAddress()).isEqualTo(UPDATED_BILLING_ADDRESS);
|
||||
assertThat(testCustomer.getBillingSalutation()).isEqualTo(UPDATED_BILLING_SALUTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -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;
|
||||
@ -34,10 +31,9 @@ import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
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.*;
|
||||
|
||||
@ -109,6 +105,11 @@ public class MembershipResourceIntTest {
|
||||
Membership membership = new Membership()
|
||||
.sinceDate(DEFAULT_SINCE_DATE)
|
||||
.untilDate(DEFAULT_UNTIL_DATE);
|
||||
// Add required entity
|
||||
Customer customer = CustomerResourceIntTest.createEntity(em);
|
||||
em.persist(customer);
|
||||
em.flush();
|
||||
membership.setCustomer(customer);
|
||||
return membership;
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
package org.hostsharing.hsadminng.web.rest;
|
||||
|
||||
import org.hostsharing.hsadminng.HsadminNgApp;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.Share;
|
||||
import org.hostsharing.hsadminng.domain.Membership;
|
||||
import org.hostsharing.hsadminng.domain.Share;
|
||||
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
|
||||
import org.hostsharing.hsadminng.repository.ShareRepository;
|
||||
import org.hostsharing.hsadminng.service.ShareQueryService;
|
||||
import org.hostsharing.hsadminng.service.ShareService;
|
||||
import org.hostsharing.hsadminng.service.dto.ShareDTO;
|
||||
import org.hostsharing.hsadminng.service.mapper.ShareMapper;
|
||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
|
||||
import org.hostsharing.hsadminng.service.dto.ShareCriteria;
|
||||
import org.hostsharing.hsadminng.service.ShareQueryService;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -32,14 +30,11 @@ import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
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.*;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
|
||||
/**
|
||||
* Test class for the ShareResource REST controller.
|
||||
*
|
||||
@ -116,6 +111,11 @@ public class ShareResourceIntTest {
|
||||
.action(DEFAULT_ACTION)
|
||||
.quantity(DEFAULT_QUANTITY)
|
||||
.comment(DEFAULT_COMMENT);
|
||||
// Add required entity
|
||||
Membership membership = MembershipResourceIntTest.createEntity(em);
|
||||
em.persist(membership);
|
||||
em.flush();
|
||||
share.setMember(membership);
|
||||
return share;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* tslint:disable max-line-length */
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { HsadminNgTestModule } from '../../../test.module';
|
||||
import { AssetUpdateComponent } from 'app/entities/asset/asset-update.component';
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* tslint:disable max-line-length */
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { HsadminNgTestModule } from '../../../test.module';
|
||||
import { CustomerUpdateComponent } from 'app/entities/customer/customer-update.component';
|
||||
|
@ -1,11 +1,9 @@
|
||||
/* tslint:disable max-line-length */
|
||||
import { TestBed, getTestBed } from '@angular/core/testing';
|
||||
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||
import { of } from 'rxjs';
|
||||
import { take, map } from 'rxjs/operators';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { CustomerService } from 'app/entities/customer/customer.service';
|
||||
import { ICustomer, Customer } from 'app/shared/model/customer.model';
|
||||
import { Customer, ICustomer } from 'app/shared/model/customer.model';
|
||||
|
||||
describe('Service Tests', () => {
|
||||
describe('Customer Service', () => {
|
||||
@ -21,7 +19,7 @@ describe('Service Tests', () => {
|
||||
service = injector.get(CustomerService);
|
||||
httpMock = injector.get(HttpTestingController);
|
||||
|
||||
elemDefault = new Customer(0, 0, 'AAAAAAA');
|
||||
elemDefault = new Customer(0, 0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA');
|
||||
});
|
||||
|
||||
describe('Service methods', async () => {
|
||||
@ -56,7 +54,12 @@ describe('Service Tests', () => {
|
||||
const returnedFromService = Object.assign(
|
||||
{
|
||||
number: 1,
|
||||
prefix: 'BBBBBB'
|
||||
prefix: 'BBBBBB',
|
||||
name: 'BBBBBB',
|
||||
contractualAddress: 'BBBBBB',
|
||||
contractualSalutation: 'BBBBBB',
|
||||
billingAddress: 'BBBBBB',
|
||||
billingSalutation: 'BBBBBB'
|
||||
},
|
||||
elemDefault
|
||||
);
|
||||
@ -74,7 +77,12 @@ describe('Service Tests', () => {
|
||||
const returnedFromService = Object.assign(
|
||||
{
|
||||
number: 1,
|
||||
prefix: 'BBBBBB'
|
||||
prefix: 'BBBBBB',
|
||||
name: 'BBBBBB',
|
||||
contractualAddress: 'BBBBBB',
|
||||
contractualSalutation: 'BBBBBB',
|
||||
billingAddress: 'BBBBBB',
|
||||
billingSalutation: 'BBBBBB'
|
||||
},
|
||||
elemDefault
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* tslint:disable max-line-length */
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { HsadminNgTestModule } from '../../../test.module';
|
||||
import { MembershipUpdateComponent } from 'app/entities/membership/membership-update.component';
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* tslint:disable max-line-length */
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { HsadminNgTestModule } from '../../../test.module';
|
||||
import { ShareUpdateComponent } from 'app/entities/share/share-update.component';
|
||||
|
Reference in New Issue
Block a user