added name+address+salutation to customer
This commit is contained in:
@ -53,6 +53,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 +120,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 +152,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 +217,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 +267,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 +287,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
|
||||
@ -327,6 +400,201 @@ public class CustomerResourceIntTest {
|
||||
defaultCustomerShouldNotBeFound("prefix.specified=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void getAllCustomersByNameIsEqualToSomething() throws Exception {
|
||||
// Initialize the database
|
||||
customerRepository.saveAndFlush(customer);
|
||||
|
||||
// Get all the customerList where name equals to DEFAULT_NAME
|
||||
defaultCustomerShouldBeFound("name.equals=" + DEFAULT_NAME);
|
||||
|
||||
// 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
|
||||
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
|
||||
@ -373,7 +641,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 +695,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 +714,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
|
||||
|
@ -21,7 +21,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 +56,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 +79,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
|
||||
);
|
||||
|
Reference in New Issue
Block a user