Merge branch 'jhipster-generated'
This commit is contained in:
		@@ -76,13 +76,13 @@ public class MembershipRepositoryIntTest {
 | 
			
		||||
        return customer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Customer createCustomerWithMembership(final String sinceDate, final String untilDate) {
 | 
			
		||||
    private Customer createCustomerWithMembership(final String from, final String to) {
 | 
			
		||||
        final Customer customer = createCustomer();
 | 
			
		||||
        final Membership membership = new Membership();
 | 
			
		||||
        membership.setCustomer(customer);
 | 
			
		||||
        membership.setSinceDate(LocalDate.parse(sinceDate));
 | 
			
		||||
        if (untilDate != null) {
 | 
			
		||||
            membership.setUntilDate(LocalDate.parse(untilDate));
 | 
			
		||||
        membership.setTo(LocalDate.parse(from));
 | 
			
		||||
        if (to != null) {
 | 
			
		||||
            membership.setFrom(LocalDate.parse(to));
 | 
			
		||||
        }
 | 
			
		||||
        membershipRepository.save(membership);
 | 
			
		||||
        return customer;
 | 
			
		||||
 
 | 
			
		||||
@@ -101,12 +101,12 @@ public class MembershipValidatorUnitTest {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        GivenMembershipValidationTestCase since(final String sinceDate) {
 | 
			
		||||
            membershipDto.setSinceDate(LocalDate.parse(sinceDate));
 | 
			
		||||
            membershipDto.setFrom(LocalDate.parse(sinceDate));
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public GivenMembershipValidationTestCase until(final String untilDate) {
 | 
			
		||||
            membershipDto.setUntilDate(LocalDate.parse(untilDate));
 | 
			
		||||
            membershipDto.setTo(LocalDate.parse(untilDate));
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,17 @@
 | 
			
		||||
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;
 | 
			
		||||
@@ -31,11 +33,14 @@ 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.
 | 
			
		||||
 *
 | 
			
		||||
@@ -116,7 +121,7 @@ public class AssetResourceIntTest {
 | 
			
		||||
        Membership membership = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        asset.setMember(membership);
 | 
			
		||||
        asset.setMembership(membership);
 | 
			
		||||
        return asset;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -443,20 +448,20 @@ public class AssetResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllAssetsByMemberIsEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllAssetsByMembershipIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Membership member = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(member);
 | 
			
		||||
        Membership membership = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        asset.setMember(member);
 | 
			
		||||
        asset.setMembership(membership);
 | 
			
		||||
        assetRepository.saveAndFlush(asset);
 | 
			
		||||
        Long memberId = member.getId();
 | 
			
		||||
        Long membershipId = membership.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the assetList where member equals to memberId
 | 
			
		||||
        defaultAssetShouldBeFound("memberId.equals=" + memberId);
 | 
			
		||||
        // Get all the assetList where membership equals to membershipId
 | 
			
		||||
        defaultAssetShouldBeFound("membershipId.equals=" + membershipId);
 | 
			
		||||
 | 
			
		||||
        // Get all the assetList where member equals to memberId + 1
 | 
			
		||||
        defaultAssetShouldNotBeFound("memberId.equals=" + (memberId + 1));
 | 
			
		||||
        // Get all the assetList where membership equals to membershipId + 1
 | 
			
		||||
        defaultAssetShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,535 +0,0 @@
 | 
			
		||||
package org.hostsharing.hsadminng.web.rest;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.HsadminNgApp;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Contact;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.CustomerContact;
 | 
			
		||||
import org.hostsharing.hsadminng.repository.ContactRepository;
 | 
			
		||||
import org.hostsharing.hsadminng.service.ContactService;
 | 
			
		||||
import org.hostsharing.hsadminng.service.dto.ContactDTO;
 | 
			
		||||
import org.hostsharing.hsadminng.service.mapper.ContactMapper;
 | 
			
		||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
 | 
			
		||||
import org.hostsharing.hsadminng.service.ContactQueryService;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.junit.runner.RunWith;
 | 
			
		||||
import org.mockito.MockitoAnnotations;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.boot.test.context.SpringBootTest;
 | 
			
		||||
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 | 
			
		||||
import org.springframework.test.context.junit4.SpringRunner;
 | 
			
		||||
import org.springframework.test.web.servlet.MockMvc;
 | 
			
		||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
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.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
 | 
			
		||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Test class for the ContactResource REST controller.
 | 
			
		||||
 *
 | 
			
		||||
 * @see ContactResource
 | 
			
		||||
 */
 | 
			
		||||
@RunWith(SpringRunner.class)
 | 
			
		||||
@SpringBootTest(classes = HsadminNgApp.class)
 | 
			
		||||
public class ContactResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_FIRST_NAME = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_FIRST_NAME = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_LAST_NAME = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_LAST_NAME = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_EMAIL = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_EMAIL = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ContactRepository contactRepository;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ContactMapper contactMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ContactService contactService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ContactQueryService contactQueryService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ExceptionTranslator exceptionTranslator;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private EntityManager em;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private Validator validator;
 | 
			
		||||
 | 
			
		||||
    private MockMvc restContactMockMvc;
 | 
			
		||||
 | 
			
		||||
    private Contact contact;
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void setup() {
 | 
			
		||||
        MockitoAnnotations.initMocks(this);
 | 
			
		||||
        final ContactResource contactResource = new ContactResource(contactService, contactQueryService);
 | 
			
		||||
        this.restContactMockMvc = MockMvcBuilders.standaloneSetup(contactResource)
 | 
			
		||||
            .setCustomArgumentResolvers(pageableArgumentResolver)
 | 
			
		||||
            .setControllerAdvice(exceptionTranslator)
 | 
			
		||||
            .setConversionService(createFormattingConversionService())
 | 
			
		||||
            .setMessageConverters(jacksonMessageConverter)
 | 
			
		||||
            .setValidator(validator).build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create an entity for this test.
 | 
			
		||||
     *
 | 
			
		||||
     * 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 Contact createEntity(EntityManager em) {
 | 
			
		||||
        Contact contact = new Contact()
 | 
			
		||||
            .firstName(DEFAULT_FIRST_NAME)
 | 
			
		||||
            .lastName(DEFAULT_LAST_NAME)
 | 
			
		||||
            .email(DEFAULT_EMAIL);
 | 
			
		||||
        return contact;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        contact = createEntity(em);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void createContact() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeCreate = contactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the Contact
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(contact);
 | 
			
		||||
        restContactMockMvc.perform(post("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isCreated());
 | 
			
		||||
 | 
			
		||||
        // Validate the Contact in the database
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeCreate + 1);
 | 
			
		||||
        Contact testContact = contactList.get(contactList.size() - 1);
 | 
			
		||||
        assertThat(testContact.getFirstName()).isEqualTo(DEFAULT_FIRST_NAME);
 | 
			
		||||
        assertThat(testContact.getLastName()).isEqualTo(DEFAULT_LAST_NAME);
 | 
			
		||||
        assertThat(testContact.getEmail()).isEqualTo(DEFAULT_EMAIL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void createContactWithExistingId() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeCreate = contactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the Contact with an existing ID
 | 
			
		||||
        contact.setId(1L);
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(contact);
 | 
			
		||||
 | 
			
		||||
        // An entity with an existing ID cannot be created, so this API call must fail
 | 
			
		||||
        restContactMockMvc.perform(post("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        // Validate the Contact in the database
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeCreate);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkFirstNameIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = contactRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        contact.setFirstName(null);
 | 
			
		||||
 | 
			
		||||
        // Create the Contact, which fails.
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(contact);
 | 
			
		||||
 | 
			
		||||
        restContactMockMvc.perform(post("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkLastNameIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = contactRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        contact.setLastName(null);
 | 
			
		||||
 | 
			
		||||
        // Create the Contact, which fails.
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(contact);
 | 
			
		||||
 | 
			
		||||
        restContactMockMvc.perform(post("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkEmailIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = contactRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        contact.setEmail(null);
 | 
			
		||||
 | 
			
		||||
        // Create the Contact, which fails.
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(contact);
 | 
			
		||||
 | 
			
		||||
        restContactMockMvc.perform(post("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContacts() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts?sort=id,desc"))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(contact.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRST_NAME.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LAST_NAME.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL.toString())));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getContact() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get the contact
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts/{id}", contact.getId()))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.id").value(contact.getId().intValue()))
 | 
			
		||||
            .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRST_NAME.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.lastName").value(DEFAULT_LAST_NAME.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL.toString()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByFirstNameIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where firstName equals to DEFAULT_FIRST_NAME
 | 
			
		||||
        defaultContactShouldBeFound("firstName.equals=" + DEFAULT_FIRST_NAME);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where firstName equals to UPDATED_FIRST_NAME
 | 
			
		||||
        defaultContactShouldNotBeFound("firstName.equals=" + UPDATED_FIRST_NAME);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByFirstNameIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where firstName in DEFAULT_FIRST_NAME or UPDATED_FIRST_NAME
 | 
			
		||||
        defaultContactShouldBeFound("firstName.in=" + DEFAULT_FIRST_NAME + "," + UPDATED_FIRST_NAME);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where firstName equals to UPDATED_FIRST_NAME
 | 
			
		||||
        defaultContactShouldNotBeFound("firstName.in=" + UPDATED_FIRST_NAME);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByFirstNameIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where firstName is not null
 | 
			
		||||
        defaultContactShouldBeFound("firstName.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where firstName is null
 | 
			
		||||
        defaultContactShouldNotBeFound("firstName.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByLastNameIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where lastName equals to DEFAULT_LAST_NAME
 | 
			
		||||
        defaultContactShouldBeFound("lastName.equals=" + DEFAULT_LAST_NAME);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where lastName equals to UPDATED_LAST_NAME
 | 
			
		||||
        defaultContactShouldNotBeFound("lastName.equals=" + UPDATED_LAST_NAME);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByLastNameIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where lastName in DEFAULT_LAST_NAME or UPDATED_LAST_NAME
 | 
			
		||||
        defaultContactShouldBeFound("lastName.in=" + DEFAULT_LAST_NAME + "," + UPDATED_LAST_NAME);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where lastName equals to UPDATED_LAST_NAME
 | 
			
		||||
        defaultContactShouldNotBeFound("lastName.in=" + UPDATED_LAST_NAME);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByLastNameIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where lastName is not null
 | 
			
		||||
        defaultContactShouldBeFound("lastName.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where lastName is null
 | 
			
		||||
        defaultContactShouldNotBeFound("lastName.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByEmailIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where email equals to DEFAULT_EMAIL
 | 
			
		||||
        defaultContactShouldBeFound("email.equals=" + DEFAULT_EMAIL);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where email equals to UPDATED_EMAIL
 | 
			
		||||
        defaultContactShouldNotBeFound("email.equals=" + UPDATED_EMAIL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByEmailIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where email in DEFAULT_EMAIL or UPDATED_EMAIL
 | 
			
		||||
        defaultContactShouldBeFound("email.in=" + DEFAULT_EMAIL + "," + UPDATED_EMAIL);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where email equals to UPDATED_EMAIL
 | 
			
		||||
        defaultContactShouldNotBeFound("email.in=" + UPDATED_EMAIL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByEmailIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where email is not null
 | 
			
		||||
        defaultContactShouldBeFound("email.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where email is null
 | 
			
		||||
        defaultContactShouldNotBeFound("email.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllContactsByRoleIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        CustomerContact role = CustomerContactResourceIntTest.createDefaultEntity(em);
 | 
			
		||||
        em.persist(role);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        contact.addRole(role);
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
        Long roleId = role.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where role equals to roleId
 | 
			
		||||
        defaultContactShouldBeFound("roleId.equals=" + roleId);
 | 
			
		||||
 | 
			
		||||
        // Get all the contactList where role equals to roleId + 1
 | 
			
		||||
        defaultContactShouldNotBeFound("roleId.equals=" + (roleId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is returned
 | 
			
		||||
     */
 | 
			
		||||
    private void defaultContactShouldBeFound(String filter) throws Exception {
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(contact.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRST_NAME)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LAST_NAME)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL)));
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 1
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts/count?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(content().string("1"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is not returned
 | 
			
		||||
     */
 | 
			
		||||
    private void defaultContactShouldNotBeFound(String filter) throws Exception {
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$").isArray())
 | 
			
		||||
            .andExpect(jsonPath("$").isEmpty());
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 0
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts/count?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(content().string("0"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getNonExistingContact() throws Exception {
 | 
			
		||||
        // Get the contact
 | 
			
		||||
        restContactMockMvc.perform(get("/api/contacts/{id}", Long.MAX_VALUE))
 | 
			
		||||
            .andExpect(status().isNotFound());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void updateContact() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        int databaseSizeBeforeUpdate = contactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Update the contact
 | 
			
		||||
        Contact updatedContact = contactRepository.findById(contact.getId()).get();
 | 
			
		||||
        // Disconnect from session so that the updates on updatedContact are not directly saved in db
 | 
			
		||||
        em.detach(updatedContact);
 | 
			
		||||
        updatedContact
 | 
			
		||||
            .firstName(UPDATED_FIRST_NAME)
 | 
			
		||||
            .lastName(UPDATED_LAST_NAME)
 | 
			
		||||
            .email(UPDATED_EMAIL);
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(updatedContact);
 | 
			
		||||
 | 
			
		||||
        restContactMockMvc.perform(put("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the Contact in the database
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
        Contact testContact = contactList.get(contactList.size() - 1);
 | 
			
		||||
        assertThat(testContact.getFirstName()).isEqualTo(UPDATED_FIRST_NAME);
 | 
			
		||||
        assertThat(testContact.getLastName()).isEqualTo(UPDATED_LAST_NAME);
 | 
			
		||||
        assertThat(testContact.getEmail()).isEqualTo(UPDATED_EMAIL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void updateNonExistingContact() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeUpdate = contactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the Contact
 | 
			
		||||
        ContactDTO contactDTO = contactMapper.toDto(contact);
 | 
			
		||||
 | 
			
		||||
        // If the entity doesn't have an ID, it will throw BadRequestAlertException
 | 
			
		||||
        restContactMockMvc.perform(put("/api/contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(contactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        // Validate the Contact in the database
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void deleteContact() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        contactRepository.saveAndFlush(contact);
 | 
			
		||||
 | 
			
		||||
        int databaseSizeBeforeDelete = contactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Delete the contact
 | 
			
		||||
        restContactMockMvc.perform(delete("/api/contacts/{id}", contact.getId())
 | 
			
		||||
            .accept(TestUtil.APPLICATION_JSON_UTF8))
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the database is empty
 | 
			
		||||
        List<Contact> contactList = contactRepository.findAll();
 | 
			
		||||
        assertThat(contactList).hasSize(databaseSizeBeforeDelete - 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void equalsVerifier() throws Exception {
 | 
			
		||||
        TestUtil.equalsVerifier(Contact.class);
 | 
			
		||||
        Contact contact1 = new Contact();
 | 
			
		||||
        contact1.setId(1L);
 | 
			
		||||
        Contact contact2 = new Contact();
 | 
			
		||||
        contact2.setId(contact1.getId());
 | 
			
		||||
        assertThat(contact1).isEqualTo(contact2);
 | 
			
		||||
        contact2.setId(2L);
 | 
			
		||||
        assertThat(contact1).isNotEqualTo(contact2);
 | 
			
		||||
        contact1.setId(null);
 | 
			
		||||
        assertThat(contact1).isNotEqualTo(contact2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void dtoEqualsVerifier() throws Exception {
 | 
			
		||||
        TestUtil.equalsVerifier(ContactDTO.class);
 | 
			
		||||
        ContactDTO contactDTO1 = new ContactDTO();
 | 
			
		||||
        contactDTO1.setId(1L);
 | 
			
		||||
        ContactDTO contactDTO2 = new ContactDTO();
 | 
			
		||||
        assertThat(contactDTO1).isNotEqualTo(contactDTO2);
 | 
			
		||||
        contactDTO2.setId(contactDTO1.getId());
 | 
			
		||||
        assertThat(contactDTO1).isEqualTo(contactDTO2);
 | 
			
		||||
        contactDTO2.setId(2L);
 | 
			
		||||
        assertThat(contactDTO1).isNotEqualTo(contactDTO2);
 | 
			
		||||
        contactDTO1.setId(null);
 | 
			
		||||
        assertThat(contactDTO1).isNotEqualTo(contactDTO2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void testEntityFromId() {
 | 
			
		||||
        assertThat(contactMapper.fromId(42L).getId()).isEqualTo(42);
 | 
			
		||||
        assertThat(contactMapper.fromId(null)).isNull();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,449 +0,0 @@
 | 
			
		||||
package org.hostsharing.hsadminng.web.rest;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.HsadminNgApp;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.domain.CustomerContact;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Contact;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Customer;
 | 
			
		||||
import org.hostsharing.hsadminng.repository.CustomerContactRepository;
 | 
			
		||||
import org.hostsharing.hsadminng.service.CustomerContactService;
 | 
			
		||||
import org.hostsharing.hsadminng.service.dto.CustomerContactDTO;
 | 
			
		||||
import org.hostsharing.hsadminng.service.mapper.CustomerContactMapper;
 | 
			
		||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
 | 
			
		||||
import org.hostsharing.hsadminng.service.CustomerContactQueryService;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.junit.runner.RunWith;
 | 
			
		||||
import org.mockito.MockitoAnnotations;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.boot.test.context.SpringBootTest;
 | 
			
		||||
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 | 
			
		||||
import org.springframework.test.context.junit4.SpringRunner;
 | 
			
		||||
import org.springframework.test.web.servlet.MockMvc;
 | 
			
		||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
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.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
 | 
			
		||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.domain.enumeration.CustomerContactRole;
 | 
			
		||||
/**
 | 
			
		||||
 * Test class for the CustomerContactResource REST controller.
 | 
			
		||||
 *
 | 
			
		||||
 * @see CustomerContactResource
 | 
			
		||||
 */
 | 
			
		||||
@RunWith(SpringRunner.class)
 | 
			
		||||
@SpringBootTest(classes = HsadminNgApp.class)
 | 
			
		||||
public class CustomerContactResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    private static final CustomerContactRole DEFAULT_ROLE = CustomerContactRole.CONTRACTUAL;
 | 
			
		||||
    private static final CustomerContactRole UPDATED_ROLE = CustomerContactRole.TECHNICAL;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CustomerContactRepository customerContactRepository;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CustomerContactMapper customerContactMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CustomerContactService customerContactService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CustomerContactQueryService customerContactQueryService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ExceptionTranslator exceptionTranslator;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private EntityManager em;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private Validator validator;
 | 
			
		||||
 | 
			
		||||
    private MockMvc restCustomerContactMockMvc;
 | 
			
		||||
 | 
			
		||||
    private CustomerContact customerContact;
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void setup() {
 | 
			
		||||
 | 
			
		||||
        MockitoAnnotations.initMocks(this);
 | 
			
		||||
        final CustomerContactResource customerContactResource = new CustomerContactResource(customerContactService, customerContactQueryService);
 | 
			
		||||
        this.restCustomerContactMockMvc = MockMvcBuilders.standaloneSetup(customerContactResource)
 | 
			
		||||
            .setCustomArgumentResolvers(pageableArgumentResolver)
 | 
			
		||||
            .setControllerAdvice(exceptionTranslator)
 | 
			
		||||
            .setConversionService(createFormattingConversionService())
 | 
			
		||||
            .setMessageConverters(jacksonMessageConverter)
 | 
			
		||||
            .setValidator(validator).build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a CustomerContaact entity for the given Customer 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 CustomerContact crateEnitity(final EntityManager em, Customer customer) {
 | 
			
		||||
        CustomerContact customerContact = new CustomerContact()
 | 
			
		||||
            .role(DEFAULT_ROLE);
 | 
			
		||||
        // Add required entity
 | 
			
		||||
        Contact contact = ContactResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(contact);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        customerContact.setContact(contact);
 | 
			
		||||
        // Add required entity
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        customerContact.setCustomer(customer);
 | 
			
		||||
        return customerContact;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create an arbitrary CustomerContact 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 CustomerContact createDefaultEntity(EntityManager em) {
 | 
			
		||||
        return crateEnitity(em, CustomerResourceIntTest.createEntity(em));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create another arbitrary CustomerContact entity for this test.
 | 
			
		||||
     *
 | 
			
		||||
     * 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 CustomerContact createAnotherEntity(EntityManager em) {
 | 
			
		||||
        return crateEnitity(em, CustomerResourceIntTest.createAnotherEntity(em));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        customerContact = createDefaultEntity(em);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void createCustomerContact() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeCreate = customerContactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the CustomerContact
 | 
			
		||||
        CustomerContactDTO customerContactDTO = customerContactMapper.toDto(customerContact);
 | 
			
		||||
        restCustomerContactMockMvc.perform(post("/api/customer-contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(customerContactDTO)))
 | 
			
		||||
            .andExpect(status().isCreated());
 | 
			
		||||
 | 
			
		||||
        // Validate the CustomerContact in the database
 | 
			
		||||
        List<CustomerContact> customerContactList = customerContactRepository.findAll();
 | 
			
		||||
        assertThat(customerContactList).hasSize(databaseSizeBeforeCreate + 1);
 | 
			
		||||
        CustomerContact testCustomerContact = customerContactList.get(customerContactList.size() - 1);
 | 
			
		||||
        assertThat(testCustomerContact.getRole()).isEqualTo(DEFAULT_ROLE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void createCustomerContactWithExistingId() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeCreate = customerContactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the CustomerContact with an existing ID
 | 
			
		||||
        customerContact.setId(1L);
 | 
			
		||||
        CustomerContactDTO customerContactDTO = customerContactMapper.toDto(customerContact);
 | 
			
		||||
 | 
			
		||||
        // An entity with an existing ID cannot be created, so this API call must fail
 | 
			
		||||
        restCustomerContactMockMvc.perform(post("/api/customer-contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(customerContactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        // Validate the CustomerContact in the database
 | 
			
		||||
        List<CustomerContact> customerContactList = customerContactRepository.findAll();
 | 
			
		||||
        assertThat(customerContactList).hasSize(databaseSizeBeforeCreate);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkRoleIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = customerContactRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        customerContact.setRole(null);
 | 
			
		||||
 | 
			
		||||
        // Create the CustomerContact, which fails.
 | 
			
		||||
        CustomerContactDTO customerContactDTO = customerContactMapper.toDto(customerContact);
 | 
			
		||||
 | 
			
		||||
        restCustomerContactMockMvc.perform(post("/api/customer-contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(customerContactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<CustomerContact> customerContactList = customerContactRepository.findAll();
 | 
			
		||||
        assertThat(customerContactList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomerContacts() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts?sort=id,desc"))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(customerContact.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].role").value(hasItem(DEFAULT_ROLE.toString())));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getCustomerContact() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        // Get the customerContact
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts/{id}", customerContact.getId()))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.id").value(customerContact.getId().intValue()))
 | 
			
		||||
            .andExpect(jsonPath("$.role").value(DEFAULT_ROLE.toString()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomerContactsByRoleIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where role equals to DEFAULT_ROLE
 | 
			
		||||
        defaultCustomerContactShouldBeFound("role.equals=" + DEFAULT_ROLE);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where role equals to UPDATED_ROLE
 | 
			
		||||
        defaultCustomerContactShouldNotBeFound("role.equals=" + UPDATED_ROLE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomerContactsByRoleIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where role in DEFAULT_ROLE or UPDATED_ROLE
 | 
			
		||||
        defaultCustomerContactShouldBeFound("role.in=" + DEFAULT_ROLE + "," + UPDATED_ROLE);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where role equals to UPDATED_ROLE
 | 
			
		||||
        defaultCustomerContactShouldNotBeFound("role.in=" + UPDATED_ROLE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomerContactsByRoleIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where role is not null
 | 
			
		||||
        defaultCustomerContactShouldBeFound("role.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where role is null
 | 
			
		||||
        defaultCustomerContactShouldNotBeFound("role.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomerContactsByContactIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Contact contact = ContactResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(contact);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        customerContact.setContact(contact);
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
        Long contactId = contact.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where contact equals to contactId
 | 
			
		||||
        defaultCustomerContactShouldBeFound("contactId.equals=" + contactId);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where contact equals to contactId + 1
 | 
			
		||||
        defaultCustomerContactShouldNotBeFound("contactId.equals=" + (contactId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomerContactsByCustomerIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createAnotherEntity(em);
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        customerContact.setCustomer(customer);
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
        Long customerId = customer.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where customer equals to customerId
 | 
			
		||||
        defaultCustomerContactShouldBeFound("customerId.equals=" + customerId);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerContactList where customer equals to customerId + 1
 | 
			
		||||
        defaultCustomerContactShouldNotBeFound("customerId.equals=" + (customerId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is returned
 | 
			
		||||
     */
 | 
			
		||||
    private void defaultCustomerContactShouldBeFound(String filter) throws Exception {
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(customerContact.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].role").value(hasItem(DEFAULT_ROLE.toString())));
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 1
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts/count?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(content().string("1"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is not returned
 | 
			
		||||
     */
 | 
			
		||||
    private void defaultCustomerContactShouldNotBeFound(String filter) throws Exception {
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$").isArray())
 | 
			
		||||
            .andExpect(jsonPath("$").isEmpty());
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 0
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts/count?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(content().string("0"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getNonExistingCustomerContact() throws Exception {
 | 
			
		||||
        // Get the customerContact
 | 
			
		||||
        restCustomerContactMockMvc.perform(get("/api/customer-contacts/{id}", Long.MAX_VALUE))
 | 
			
		||||
            .andExpect(status().isNotFound());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void updateCustomerContact() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        int databaseSizeBeforeUpdate = customerContactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Update the customerContact
 | 
			
		||||
        CustomerContact updatedCustomerContact = customerContactRepository.findById(customerContact.getId()).get();
 | 
			
		||||
        // Disconnect from session so that the updates on updatedCustomerContact are not directly saved in db
 | 
			
		||||
        em.detach(updatedCustomerContact);
 | 
			
		||||
        updatedCustomerContact
 | 
			
		||||
            .role(UPDATED_ROLE);
 | 
			
		||||
        CustomerContactDTO customerContactDTO = customerContactMapper.toDto(updatedCustomerContact);
 | 
			
		||||
 | 
			
		||||
        restCustomerContactMockMvc.perform(put("/api/customer-contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(customerContactDTO)))
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the CustomerContact in the database
 | 
			
		||||
        List<CustomerContact> customerContactList = customerContactRepository.findAll();
 | 
			
		||||
        assertThat(customerContactList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
        CustomerContact testCustomerContact = customerContactList.get(customerContactList.size() - 1);
 | 
			
		||||
        assertThat(testCustomerContact.getRole()).isEqualTo(UPDATED_ROLE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void updateNonExistingCustomerContact() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeUpdate = customerContactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the CustomerContact
 | 
			
		||||
        CustomerContactDTO customerContactDTO = customerContactMapper.toDto(customerContact);
 | 
			
		||||
 | 
			
		||||
        // If the entity doesn't have an ID, it will throw BadRequestAlertException
 | 
			
		||||
        restCustomerContactMockMvc.perform(put("/api/customer-contacts")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(customerContactDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        // Validate the CustomerContact in the database
 | 
			
		||||
        List<CustomerContact> customerContactList = customerContactRepository.findAll();
 | 
			
		||||
        assertThat(customerContactList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void deleteCustomerContact() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        customerContactRepository.saveAndFlush(customerContact);
 | 
			
		||||
 | 
			
		||||
        int databaseSizeBeforeDelete = customerContactRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Delete the customerContact
 | 
			
		||||
        restCustomerContactMockMvc.perform(delete("/api/customer-contacts/{id}", customerContact.getId())
 | 
			
		||||
            .accept(TestUtil.APPLICATION_JSON_UTF8))
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the database is empty
 | 
			
		||||
        List<CustomerContact> customerContactList = customerContactRepository.findAll();
 | 
			
		||||
        assertThat(customerContactList).hasSize(databaseSizeBeforeDelete - 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void equalsVerifier() throws Exception {
 | 
			
		||||
        TestUtil.equalsVerifier(CustomerContact.class);
 | 
			
		||||
        CustomerContact customerContact1 = new CustomerContact();
 | 
			
		||||
        customerContact1.setId(1L);
 | 
			
		||||
        CustomerContact customerContact2 = new CustomerContact();
 | 
			
		||||
        customerContact2.setId(customerContact1.getId());
 | 
			
		||||
        assertThat(customerContact1).isEqualTo(customerContact2);
 | 
			
		||||
        customerContact2.setId(2L);
 | 
			
		||||
        assertThat(customerContact1).isNotEqualTo(customerContact2);
 | 
			
		||||
        customerContact1.setId(null);
 | 
			
		||||
        assertThat(customerContact1).isNotEqualTo(customerContact2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void dtoEqualsVerifier() throws Exception {
 | 
			
		||||
        TestUtil.equalsVerifier(CustomerContactDTO.class);
 | 
			
		||||
        CustomerContactDTO customerContactDTO1 = new CustomerContactDTO();
 | 
			
		||||
        customerContactDTO1.setId(1L);
 | 
			
		||||
        CustomerContactDTO customerContactDTO2 = new CustomerContactDTO();
 | 
			
		||||
        assertThat(customerContactDTO1).isNotEqualTo(customerContactDTO2);
 | 
			
		||||
        customerContactDTO2.setId(customerContactDTO1.getId());
 | 
			
		||||
        assertThat(customerContactDTO1).isEqualTo(customerContactDTO2);
 | 
			
		||||
        customerContactDTO2.setId(2L);
 | 
			
		||||
        assertThat(customerContactDTO1).isNotEqualTo(customerContactDTO2);
 | 
			
		||||
        customerContactDTO1.setId(null);
 | 
			
		||||
        assertThat(customerContactDTO1).isNotEqualTo(customerContactDTO2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void testEntityFromId() {
 | 
			
		||||
        assertThat(customerContactMapper.fromId(42L).getId()).isEqualTo(42);
 | 
			
		||||
        assertThat(customerContactMapper.fromId(null)).isNull();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,15 +1,18 @@
 | 
			
		||||
package org.hostsharing.hsadminng.web.rest;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.HsadminNgApp;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Customer;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.CustomerContact;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Membership;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.SepaMandate;
 | 
			
		||||
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;
 | 
			
		||||
@@ -28,9 +31,10 @@ 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.*;
 | 
			
		||||
 | 
			
		||||
@@ -45,30 +49,24 @@ public class CustomerResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    private static final Integer DEFAULT_NUMBER = 10000;
 | 
			
		||||
    private static final Integer UPDATED_NUMBER = 10001;
 | 
			
		||||
    private static final Integer OTHER_NUMBER_BASE = 11000;
 | 
			
		||||
 | 
			
		||||
    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_PREFIX = "nf";
 | 
			
		||||
    private static final String UPDATED_PREFIX = "m2";
 | 
			
		||||
 | 
			
		||||
    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_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_NAME = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_NAME = "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_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static int otherCounter = 0;
 | 
			
		||||
    private static final String DEFAULT_BILLING_ADDRESS = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_BILLING_ADDRESS = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CustomerRepository customerRepository;
 | 
			
		||||
@@ -114,7 +112,7 @@ public class CustomerResourceIntTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create an entity for tests.
 | 
			
		||||
     * Create an entity for this test.
 | 
			
		||||
     *
 | 
			
		||||
     * This is a static method, as tests for other entities might also need it,
 | 
			
		||||
     * if they test an entity which requires the current entity.
 | 
			
		||||
@@ -124,26 +122,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
            .number(DEFAULT_NUMBER)
 | 
			
		||||
            .prefix(DEFAULT_PREFIX)
 | 
			
		||||
            .name(DEFAULT_NAME)
 | 
			
		||||
            .contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
 | 
			
		||||
            .contractualSalutation(DEFAULT_CONTRACTUAL_SALUTATION)
 | 
			
		||||
            .billingAddress(DEFAULT_BILLING_ADDRESS)
 | 
			
		||||
            .billingSalutation(DEFAULT_BILLING_SALUTATION);
 | 
			
		||||
        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 createAnotherEntity(EntityManager em) {
 | 
			
		||||
        Customer customer = new Customer()
 | 
			
		||||
            .number(OTHER_NUMBER_BASE + otherCounter)
 | 
			
		||||
            .prefix(OTHER_PREFIX_BASE + String.format("%02d", otherCounter))
 | 
			
		||||
            .name(OTHER_NAME_BASE + otherCounter)
 | 
			
		||||
            .contractualAddress(OTHER_CONTRACTUAL_ADDRESS_BASE + otherCounter);
 | 
			
		||||
        ++otherCounter;
 | 
			
		||||
            .contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
 | 
			
		||||
            .billingSalutation(DEFAULT_BILLING_SALUTATION)
 | 
			
		||||
            .billingAddress(DEFAULT_BILLING_ADDRESS);
 | 
			
		||||
        return customer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -171,10 +153,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
        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.getContractualAddress()).isEqualTo(DEFAULT_CONTRACTUAL_ADDRESS);
 | 
			
		||||
        assertThat(testCustomer.getBillingSalutation()).isEqualTo(DEFAULT_BILLING_SALUTATION);
 | 
			
		||||
        assertThat(testCustomer.getBillingAddress()).isEqualTo(DEFAULT_BILLING_ADDRESS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -287,10 +269,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
            .andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
 | 
			
		||||
            .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())));
 | 
			
		||||
            .andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS.toString())));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -307,10 +289,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
            .andExpect(jsonPath("$.number").value(DEFAULT_NUMBER))
 | 
			
		||||
            .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()));
 | 
			
		||||
            .andExpect(jsonPath("$.contractualAddress").value(DEFAULT_CONTRACTUAL_ADDRESS.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.billingSalutation").value(DEFAULT_BILLING_SALUTATION.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.billingAddress").value(DEFAULT_BILLING_ADDRESS.toString()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -457,45 +439,6 @@ public class CustomerResourceIntTest {
 | 
			
		||||
        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 {
 | 
			
		||||
@@ -537,41 +480,41 @@ public class CustomerResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllCustomersByContractualAddressIsEqualToSomething() 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 contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS
 | 
			
		||||
        defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
 | 
			
		||||
        defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
 | 
			
		||||
        // Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
 | 
			
		||||
        defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception {
 | 
			
		||||
    public void getAllCustomersByContractualAddressIsInShouldWork() 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 contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS
 | 
			
		||||
        defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
 | 
			
		||||
        defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
 | 
			
		||||
        // Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
 | 
			
		||||
        defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception {
 | 
			
		||||
    public void getAllCustomersByContractualAddressIsNullOrNotNull() 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 contractualAddress is not null
 | 
			
		||||
        defaultCustomerShouldBeFound("contractualAddress.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the customerList where billingAddress is null
 | 
			
		||||
        defaultCustomerShouldNotBeFound("billingAddress.specified=false");
 | 
			
		||||
        // Get all the customerList where contractualAddress is null
 | 
			
		||||
        defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -613,6 +556,45 @@ public class CustomerResourceIntTest {
 | 
			
		||||
        defaultCustomerShouldNotBeFound("billingSalutation.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 getAllCustomersByMembershipIsEqualToSomething() throws Exception {
 | 
			
		||||
@@ -634,20 +616,20 @@ public class CustomerResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomersByRoleIsEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllCustomersBySepamandateIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        CustomerContact role = CustomerContactResourceIntTest.createAnotherEntity(em);
 | 
			
		||||
        em.persist(role);
 | 
			
		||||
        SepaMandate sepamandate = SepaMandateResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(sepamandate);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        customer.addRole(role);
 | 
			
		||||
        customer.addSepamandate(sepamandate);
 | 
			
		||||
        customerRepository.saveAndFlush(customer);
 | 
			
		||||
        Long roleId = role.getId();
 | 
			
		||||
        Long sepamandateId = sepamandate.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the customerList where role equals to roleId
 | 
			
		||||
        defaultCustomerShouldBeFound("roleId.equals=" + roleId);
 | 
			
		||||
        // Get all the customerList where sepamandate equals to sepamandateId
 | 
			
		||||
        defaultCustomerShouldBeFound("sepamandateId.equals=" + sepamandateId);
 | 
			
		||||
 | 
			
		||||
        // Get all the customerList where role equals to roleId + 1
 | 
			
		||||
        defaultCustomerShouldNotBeFound("roleId.equals=" + (roleId + 1));
 | 
			
		||||
        // Get all the customerList where sepamandate equals to sepamandateId + 1
 | 
			
		||||
        defaultCustomerShouldNotBeFound("sepamandateId.equals=" + (sepamandateId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -661,10 +643,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
            .andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
 | 
			
		||||
            .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)));
 | 
			
		||||
            .andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS)));
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 1
 | 
			
		||||
        restCustomerMockMvc.perform(get("/api/customers/count?sort=id,desc&" + filter))
 | 
			
		||||
@@ -715,10 +697,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
            .number(UPDATED_NUMBER)
 | 
			
		||||
            .prefix(UPDATED_PREFIX)
 | 
			
		||||
            .name(UPDATED_NAME)
 | 
			
		||||
            .contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
 | 
			
		||||
            .contractualSalutation(UPDATED_CONTRACTUAL_SALUTATION)
 | 
			
		||||
            .billingAddress(UPDATED_BILLING_ADDRESS)
 | 
			
		||||
            .billingSalutation(UPDATED_BILLING_SALUTATION);
 | 
			
		||||
            .contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
 | 
			
		||||
            .billingSalutation(UPDATED_BILLING_SALUTATION)
 | 
			
		||||
            .billingAddress(UPDATED_BILLING_ADDRESS);
 | 
			
		||||
        CustomerDTO customerDTO = customerMapper.toDto(updatedCustomer);
 | 
			
		||||
 | 
			
		||||
        restCustomerMockMvc.perform(put("/api/customers")
 | 
			
		||||
@@ -733,10 +715,10 @@ public class CustomerResourceIntTest {
 | 
			
		||||
        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.getContractualAddress()).isEqualTo(UPDATED_CONTRACTUAL_ADDRESS);
 | 
			
		||||
        assertThat(testCustomer.getBillingSalutation()).isEqualTo(UPDATED_BILLING_SALUTATION);
 | 
			
		||||
        assertThat(testCustomer.getBillingAddress()).isEqualTo(UPDATED_BILLING_ADDRESS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,19 @@
 | 
			
		||||
package org.hostsharing.hsadminng.web.rest;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.HsadminNgApp;
 | 
			
		||||
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.domain.Asset;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Customer;
 | 
			
		||||
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;
 | 
			
		||||
@@ -31,9 +34,10 @@ 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.*;
 | 
			
		||||
 | 
			
		||||
@@ -46,12 +50,14 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 | 
			
		||||
@SpringBootTest(classes = HsadminNgApp.class)
 | 
			
		||||
public class MembershipResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_SINCE_DATE = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
    private static final LocalDate UPDATED_SINCE_DATE = DEFAULT_SINCE_DATE.plusMonths(1);
 | 
			
		||||
    private static final LocalDate DEFAULT_FROM = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_FROM = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_UNTIL_DATE = UPDATED_SINCE_DATE.plusDays(600).withMonth(12).withDayOfMonth(31);
 | 
			
		||||
    private static final LocalDate UPDATED_UNTIL_DATE = DEFAULT_UNTIL_DATE.plusYears(1);
 | 
			
		||||
    private static final LocalDate ANOTHER_QUERY_DATE = DEFAULT_UNTIL_DATE.plusMonths(2);
 | 
			
		||||
    private static final LocalDate DEFAULT_TO = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_TO = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_COMMENT = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_COMMENT = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private MembershipRepository membershipRepository;
 | 
			
		||||
@@ -102,12 +108,13 @@ public class MembershipResourceIntTest {
 | 
			
		||||
     * 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 createEntity(final EntityManager em) {
 | 
			
		||||
    public static Membership createEntity(EntityManager em) {
 | 
			
		||||
        Membership membership = new Membership()
 | 
			
		||||
            .sinceDate(DEFAULT_SINCE_DATE)
 | 
			
		||||
            .untilDate(DEFAULT_UNTIL_DATE);
 | 
			
		||||
            .from(DEFAULT_FROM)
 | 
			
		||||
            .to(DEFAULT_TO)
 | 
			
		||||
            .comment(DEFAULT_COMMENT);
 | 
			
		||||
        // Add required entity
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createAnotherEntity(em);
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        membership.setCustomer(customer);
 | 
			
		||||
@@ -135,8 +142,9 @@ public class MembershipResourceIntTest {
 | 
			
		||||
        List<Membership> membershipList = membershipRepository.findAll();
 | 
			
		||||
        assertThat(membershipList).hasSize(databaseSizeBeforeCreate + 1);
 | 
			
		||||
        Membership testMembership = membershipList.get(membershipList.size() - 1);
 | 
			
		||||
        assertThat(testMembership.getSinceDate()).isEqualTo(DEFAULT_SINCE_DATE);
 | 
			
		||||
        assertThat(testMembership.getUntilDate()).isEqualTo(DEFAULT_UNTIL_DATE);
 | 
			
		||||
        assertThat(testMembership.getFrom()).isEqualTo(DEFAULT_FROM);
 | 
			
		||||
        assertThat(testMembership.getTo()).isEqualTo(DEFAULT_TO);
 | 
			
		||||
        assertThat(testMembership.getComment()).isEqualTo(DEFAULT_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -161,10 +169,10 @@ public class MembershipResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkSinceDateIsRequired() throws Exception {
 | 
			
		||||
    public void checkFromIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = membershipRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        membership.setSinceDate(null);
 | 
			
		||||
        membership.setFrom(null);
 | 
			
		||||
 | 
			
		||||
        // Create the Membership, which fails.
 | 
			
		||||
        MembershipDTO membershipDTO = membershipMapper.toDto(membership);
 | 
			
		||||
@@ -189,8 +197,9 @@ public class MembershipResourceIntTest {
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(membership.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].sinceDate").value(hasItem(DEFAULT_SINCE_DATE.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].untilDate").value(hasItem(DEFAULT_UNTIL_DATE.toString())));
 | 
			
		||||
            .andExpect(jsonPath("$.[*].from").value(hasItem(DEFAULT_FROM.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].to").value(hasItem(DEFAULT_TO.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString())));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -204,151 +213,191 @@ public class MembershipResourceIntTest {
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.id").value(membership.getId().intValue()))
 | 
			
		||||
            .andExpect(jsonPath("$.sinceDate").value(DEFAULT_SINCE_DATE.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.untilDate").value(DEFAULT_UNTIL_DATE.toString()));
 | 
			
		||||
            .andExpect(jsonPath("$.from").value(DEFAULT_FROM.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.to").value(DEFAULT_TO.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.comment").value(DEFAULT_COMMENT.toString()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsBySinceDateIsEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByFromIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate equals to DEFAULT_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("sinceDate.equals=" + DEFAULT_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from equals to DEFAULT_FROM
 | 
			
		||||
        defaultMembershipShouldBeFound("from.equals=" + DEFAULT_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate equals to UPDATED_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("sinceDate.equals=" + UPDATED_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from equals to UPDATED_FROM
 | 
			
		||||
        defaultMembershipShouldNotBeFound("from.equals=" + UPDATED_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsBySinceDateIsInShouldWork() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByFromIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate in DEFAULT_SINCE_DATE or UPDATED_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("sinceDate.in=" + DEFAULT_SINCE_DATE + "," + UPDATED_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from in DEFAULT_FROM or UPDATED_FROM
 | 
			
		||||
        defaultMembershipShouldBeFound("from.in=" + DEFAULT_FROM + "," + UPDATED_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate equals to UPDATED_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("sinceDate.in=" + UPDATED_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from equals to UPDATED_FROM
 | 
			
		||||
        defaultMembershipShouldNotBeFound("from.in=" + UPDATED_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsBySinceDateIsNullOrNotNull() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByFromIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate is not null
 | 
			
		||||
        defaultMembershipShouldBeFound("sinceDate.specified=true");
 | 
			
		||||
        // Get all the membershipList where from is not null
 | 
			
		||||
        defaultMembershipShouldBeFound("from.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate is null
 | 
			
		||||
        defaultMembershipShouldNotBeFound("sinceDate.specified=false");
 | 
			
		||||
        // Get all the membershipList where from is null
 | 
			
		||||
        defaultMembershipShouldNotBeFound("from.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsBySinceDateIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByFromIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate greater than or equals to DEFAULT_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("sinceDate.greaterOrEqualThan=" + DEFAULT_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from greater than or equals to DEFAULT_FROM
 | 
			
		||||
        defaultMembershipShouldBeFound("from.greaterOrEqualThan=" + DEFAULT_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate greater than or equals to UPDATED_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("sinceDate.greaterOrEqualThan=" + UPDATED_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from greater than or equals to UPDATED_FROM
 | 
			
		||||
        defaultMembershipShouldNotBeFound("from.greaterOrEqualThan=" + UPDATED_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsBySinceDateIsLessThanSomething() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByFromIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate less than or equals to DEFAULT_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("sinceDate.lessThan=" + DEFAULT_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from less than or equals to DEFAULT_FROM
 | 
			
		||||
        defaultMembershipShouldNotBeFound("from.lessThan=" + DEFAULT_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where sinceDate less than or equals to UPDATED_SINCE_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("sinceDate.lessThan=" + UPDATED_SINCE_DATE);
 | 
			
		||||
        // Get all the membershipList where from less than or equals to UPDATED_FROM
 | 
			
		||||
        defaultMembershipShouldBeFound("from.lessThan=" + UPDATED_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByUntilDateIsEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByToIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate equals to DEFAULT_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("untilDate.equals=" + DEFAULT_UNTIL_DATE);
 | 
			
		||||
        // Get all the membershipList where to equals to DEFAULT_TO
 | 
			
		||||
        defaultMembershipShouldBeFound("to.equals=" + DEFAULT_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate equals to UPDATED_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("untilDate.equals=" + asString(UPDATED_UNTIL_DATE));
 | 
			
		||||
        // Get all the membershipList where to equals to UPDATED_TO
 | 
			
		||||
        defaultMembershipShouldNotBeFound("to.equals=" + UPDATED_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByUntilDateIsInShouldWork() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByToIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate in DEFAULT_UNTIL_DATE or UPDATED_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("untilDate.in=" + DEFAULT_UNTIL_DATE + "," + ANOTHER_QUERY_DATE);
 | 
			
		||||
        // Get all the membershipList where to in DEFAULT_TO or UPDATED_TO
 | 
			
		||||
        defaultMembershipShouldBeFound("to.in=" + DEFAULT_TO + "," + UPDATED_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate equals to UPDATED_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("untilDate.in=" + asString(UPDATED_UNTIL_DATE));
 | 
			
		||||
        // Get all the membershipList where to equals to UPDATED_TO
 | 
			
		||||
        defaultMembershipShouldNotBeFound("to.in=" + UPDATED_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByUntilDateIsNullOrNotNull() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByToIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate is not null
 | 
			
		||||
        defaultMembershipShouldBeFound("untilDate.specified=true");
 | 
			
		||||
        // Get all the membershipList where to is not null
 | 
			
		||||
        defaultMembershipShouldBeFound("to.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate is null
 | 
			
		||||
        defaultMembershipShouldNotBeFound("untilDate.specified=false");
 | 
			
		||||
        // Get all the membershipList where to is null
 | 
			
		||||
        defaultMembershipShouldNotBeFound("to.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByUntilDateIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByToIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate greater than or equals to DEFAULT_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("untilDate.greaterOrEqualThan=" + DEFAULT_UNTIL_DATE);
 | 
			
		||||
        // Get all the membershipList where to greater than or equals to DEFAULT_TO
 | 
			
		||||
        defaultMembershipShouldBeFound("to.greaterOrEqualThan=" + DEFAULT_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate greater than or equals to UPDATED_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("untilDate.greaterOrEqualThan=" + asString(UPDATED_UNTIL_DATE));
 | 
			
		||||
        // Get all the membershipList where to greater than or equals to UPDATED_TO
 | 
			
		||||
        defaultMembershipShouldNotBeFound("to.greaterOrEqualThan=" + UPDATED_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByUntilDateIsLessThanSomething() throws Exception {
 | 
			
		||||
    public void getAllMembershipsByToIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate less than or equals to DEFAULT_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldNotBeFound("untilDate.lessThan=" + DEFAULT_UNTIL_DATE);
 | 
			
		||||
        // Get all the membershipList where to less than or equals to DEFAULT_TO
 | 
			
		||||
        defaultMembershipShouldNotBeFound("to.lessThan=" + DEFAULT_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where untilDate less than or equals to UPDATED_UNTIL_DATE
 | 
			
		||||
        defaultMembershipShouldBeFound("untilDate.lessThan=" + asString(UPDATED_UNTIL_DATE));
 | 
			
		||||
        // Get all the membershipList where to less than or equals to UPDATED_TO
 | 
			
		||||
        defaultMembershipShouldBeFound("to.lessThan=" + UPDATED_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByCommentIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where comment equals to DEFAULT_COMMENT
 | 
			
		||||
        defaultMembershipShouldBeFound("comment.equals=" + DEFAULT_COMMENT);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where comment equals to UPDATED_COMMENT
 | 
			
		||||
        defaultMembershipShouldNotBeFound("comment.equals=" + UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByCommentIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where comment in DEFAULT_COMMENT or UPDATED_COMMENT
 | 
			
		||||
        defaultMembershipShouldBeFound("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where comment equals to UPDATED_COMMENT
 | 
			
		||||
        defaultMembershipShouldNotBeFound("comment.in=" + UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByCommentIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where comment is not null
 | 
			
		||||
        defaultMembershipShouldBeFound("comment.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where comment is null
 | 
			
		||||
        defaultMembershipShouldNotBeFound("comment.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByShareIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Share share = ShareResourceIntTest.createEntity(em, membership);
 | 
			
		||||
        Share share = ShareResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(share);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        membership.addShare(share);
 | 
			
		||||
        membershipRepository.flush();
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
        Long shareId = share.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where share equals to shareId
 | 
			
		||||
@@ -364,10 +413,10 @@ public class MembershipResourceIntTest {
 | 
			
		||||
    public void getAllMembershipsByAssetIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Asset asset = AssetResourceIntTest.createEntity(em);
 | 
			
		||||
        membership.addAsset(asset);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.persist(asset);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        membership.addAsset(asset);
 | 
			
		||||
        membershipRepository.saveAndFlush(membership);
 | 
			
		||||
        Long assetId = asset.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where asset equals to assetId
 | 
			
		||||
@@ -382,7 +431,7 @@ public class MembershipResourceIntTest {
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByCustomerIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createAnotherEntity(em);
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        membership.setCustomer(customer);
 | 
			
		||||
@@ -404,8 +453,9 @@ public class MembershipResourceIntTest {
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(membership.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].sinceDate").value(hasItem(DEFAULT_SINCE_DATE.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].untilDate").value(hasItem(DEFAULT_UNTIL_DATE.toString())));
 | 
			
		||||
            .andExpect(jsonPath("$.[*].from").value(hasItem(DEFAULT_FROM.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].to").value(hasItem(DEFAULT_TO.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT)));
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 1
 | 
			
		||||
        restMembershipMockMvc.perform(get("/api/memberships/count?sort=id,desc&" + filter))
 | 
			
		||||
@@ -453,8 +503,9 @@ public class MembershipResourceIntTest {
 | 
			
		||||
        // Disconnect from session so that the updates on updatedMembership are not directly saved in db
 | 
			
		||||
        em.detach(updatedMembership);
 | 
			
		||||
        updatedMembership
 | 
			
		||||
            .sinceDate(UPDATED_SINCE_DATE)
 | 
			
		||||
            .untilDate(UPDATED_UNTIL_DATE);
 | 
			
		||||
            .from(UPDATED_FROM)
 | 
			
		||||
            .to(UPDATED_TO)
 | 
			
		||||
            .comment(UPDATED_COMMENT);
 | 
			
		||||
        MembershipDTO membershipDTO = membershipMapper.toDto(updatedMembership);
 | 
			
		||||
 | 
			
		||||
        restMembershipMockMvc.perform(put("/api/memberships")
 | 
			
		||||
@@ -466,8 +517,9 @@ public class MembershipResourceIntTest {
 | 
			
		||||
        List<Membership> membershipList = membershipRepository.findAll();
 | 
			
		||||
        assertThat(membershipList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
        Membership testMembership = membershipList.get(membershipList.size() - 1);
 | 
			
		||||
        assertThat(testMembership.getSinceDate()).isEqualTo(UPDATED_SINCE_DATE);
 | 
			
		||||
        assertThat(testMembership.getUntilDate()).isEqualTo(UPDATED_UNTIL_DATE);
 | 
			
		||||
        assertThat(testMembership.getFrom()).isEqualTo(UPDATED_FROM);
 | 
			
		||||
        assertThat(testMembership.getTo()).isEqualTo(UPDATED_TO);
 | 
			
		||||
        assertThat(testMembership.getComment()).isEqualTo(UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -500,11 +552,11 @@ public class MembershipResourceIntTest {
 | 
			
		||||
        // Delete the membership
 | 
			
		||||
        restMembershipMockMvc.perform(delete("/api/memberships/{id}", membership.getId())
 | 
			
		||||
            .accept(TestUtil.APPLICATION_JSON_UTF8))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the database is unchanged empty
 | 
			
		||||
        // Validate the database is empty
 | 
			
		||||
        List<Membership> membershipList = membershipRepository.findAll();
 | 
			
		||||
        assertThat(membershipList).hasSize(databaseSizeBeforeDelete);
 | 
			
		||||
        assertThat(membershipList).hasSize(databaseSizeBeforeDelete - 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -544,8 +596,4 @@ public class MembershipResourceIntTest {
 | 
			
		||||
        assertThat(membershipMapper.fromId(42L).getId()).isEqualTo(42);
 | 
			
		||||
        assertThat(membershipMapper.fromId(null)).isNull();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String asString(LocalDate updatedUntilDate) {
 | 
			
		||||
        return updatedUntilDate == null ? "" : updatedUntilDate.toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,972 @@
 | 
			
		||||
package org.hostsharing.hsadminng.web.rest;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.HsadminNgApp;
 | 
			
		||||
 | 
			
		||||
import org.hostsharing.hsadminng.domain.SepaMandate;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Customer;
 | 
			
		||||
import org.hostsharing.hsadminng.repository.SepaMandateRepository;
 | 
			
		||||
import org.hostsharing.hsadminng.service.SepaMandateService;
 | 
			
		||||
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
 | 
			
		||||
import org.hostsharing.hsadminng.service.mapper.SepaMandateMapper;
 | 
			
		||||
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
 | 
			
		||||
import org.hostsharing.hsadminng.service.dto.SepaMandateCriteria;
 | 
			
		||||
import org.hostsharing.hsadminng.service.SepaMandateQueryService;
 | 
			
		||||
 | 
			
		||||
import org.junit.Before;
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.junit.runner.RunWith;
 | 
			
		||||
import org.mockito.MockitoAnnotations;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.boot.test.context.SpringBootTest;
 | 
			
		||||
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 | 
			
		||||
import org.springframework.test.context.junit4.SpringRunner;
 | 
			
		||||
import org.springframework.test.web.servlet.MockMvc;
 | 
			
		||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.validation.Validator;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.EntityManager;
 | 
			
		||||
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.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
 | 
			
		||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Test class for the SepaMandateResource REST controller.
 | 
			
		||||
 *
 | 
			
		||||
 * @see SepaMandateResource
 | 
			
		||||
 */
 | 
			
		||||
@RunWith(SpringRunner.class)
 | 
			
		||||
@SpringBootTest(classes = HsadminNgApp.class)
 | 
			
		||||
public class SepaMandateResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_REFERENCE = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_REFERENCE = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_IBAN = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_IBAN = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_BIC = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_BIC = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_CREATED = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_CREATED = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_VALID_FROM = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_VALID_FROM = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_VALID_TO = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_VALID_TO = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_LAST_USED = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_LAST_USED = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final LocalDate DEFAULT_CANCELLED = LocalDate.ofEpochDay(0L);
 | 
			
		||||
    private static final LocalDate UPDATED_CANCELLED = LocalDate.now(ZoneId.systemDefault());
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_COMMENT = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_COMMENT = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private SepaMandateRepository sepaMandateRepository;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private SepaMandateMapper sepaMandateMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private SepaMandateService sepaMandateService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private SepaMandateQueryService sepaMandateQueryService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ExceptionTranslator exceptionTranslator;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private EntityManager em;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private Validator validator;
 | 
			
		||||
 | 
			
		||||
    private MockMvc restSepaMandateMockMvc;
 | 
			
		||||
 | 
			
		||||
    private SepaMandate sepaMandate;
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void setup() {
 | 
			
		||||
        MockitoAnnotations.initMocks(this);
 | 
			
		||||
        final SepaMandateResource sepaMandateResource = new SepaMandateResource(sepaMandateService, sepaMandateQueryService);
 | 
			
		||||
        this.restSepaMandateMockMvc = MockMvcBuilders.standaloneSetup(sepaMandateResource)
 | 
			
		||||
            .setCustomArgumentResolvers(pageableArgumentResolver)
 | 
			
		||||
            .setControllerAdvice(exceptionTranslator)
 | 
			
		||||
            .setConversionService(createFormattingConversionService())
 | 
			
		||||
            .setMessageConverters(jacksonMessageConverter)
 | 
			
		||||
            .setValidator(validator).build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create an entity for this test.
 | 
			
		||||
     *
 | 
			
		||||
     * 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) {
 | 
			
		||||
        SepaMandate sepaMandate = new SepaMandate()
 | 
			
		||||
            .reference(DEFAULT_REFERENCE)
 | 
			
		||||
            .iban(DEFAULT_IBAN)
 | 
			
		||||
            .bic(DEFAULT_BIC)
 | 
			
		||||
            .created(DEFAULT_CREATED)
 | 
			
		||||
            .validFrom(DEFAULT_VALID_FROM)
 | 
			
		||||
            .validTo(DEFAULT_VALID_TO)
 | 
			
		||||
            .lastUsed(DEFAULT_LAST_USED)
 | 
			
		||||
            .cancelled(DEFAULT_CANCELLED)
 | 
			
		||||
            .comment(DEFAULT_COMMENT);
 | 
			
		||||
        // Add required entity
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        sepaMandate.setCustomer(customer);
 | 
			
		||||
        return sepaMandate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        sepaMandate = createEntity(em);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void createSepaMandate() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeCreate = sepaMandateRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the SepaMandate
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
 | 
			
		||||
        restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isCreated());
 | 
			
		||||
 | 
			
		||||
        // Validate the SepaMandate in the database
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeCreate + 1);
 | 
			
		||||
        SepaMandate testSepaMandate = sepaMandateList.get(sepaMandateList.size() - 1);
 | 
			
		||||
        assertThat(testSepaMandate.getReference()).isEqualTo(DEFAULT_REFERENCE);
 | 
			
		||||
        assertThat(testSepaMandate.getIban()).isEqualTo(DEFAULT_IBAN);
 | 
			
		||||
        assertThat(testSepaMandate.getBic()).isEqualTo(DEFAULT_BIC);
 | 
			
		||||
        assertThat(testSepaMandate.getCreated()).isEqualTo(DEFAULT_CREATED);
 | 
			
		||||
        assertThat(testSepaMandate.getValidFrom()).isEqualTo(DEFAULT_VALID_FROM);
 | 
			
		||||
        assertThat(testSepaMandate.getValidTo()).isEqualTo(DEFAULT_VALID_TO);
 | 
			
		||||
        assertThat(testSepaMandate.getLastUsed()).isEqualTo(DEFAULT_LAST_USED);
 | 
			
		||||
        assertThat(testSepaMandate.getCancelled()).isEqualTo(DEFAULT_CANCELLED);
 | 
			
		||||
        assertThat(testSepaMandate.getComment()).isEqualTo(DEFAULT_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void createSepaMandateWithExistingId() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeCreate = sepaMandateRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the SepaMandate with an existing ID
 | 
			
		||||
        sepaMandate.setId(1L);
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // An entity with an existing ID cannot be created, so this API call must fail
 | 
			
		||||
        restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        // Validate the SepaMandate in the database
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeCreate);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkReferenceIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = sepaMandateRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        sepaMandate.setReference(null);
 | 
			
		||||
 | 
			
		||||
        // Create the SepaMandate, which fails.
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkCreatedIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = sepaMandateRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        sepaMandate.setCreated(null);
 | 
			
		||||
 | 
			
		||||
        // Create the SepaMandate, which fails.
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void checkValidFromIsRequired() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeTest = sepaMandateRepository.findAll().size();
 | 
			
		||||
        // set the field null
 | 
			
		||||
        sepaMandate.setValidFrom(null);
 | 
			
		||||
 | 
			
		||||
        // Create the SepaMandate, which fails.
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        restSepaMandateMockMvc.perform(post("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeTest);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandates() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates?sort=id,desc"))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(sepaMandate.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].reference").value(hasItem(DEFAULT_REFERENCE.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].iban").value(hasItem(DEFAULT_IBAN.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].bic").value(hasItem(DEFAULT_BIC.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].created").value(hasItem(DEFAULT_CREATED.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].validFrom").value(hasItem(DEFAULT_VALID_FROM.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].validTo").value(hasItem(DEFAULT_VALID_TO.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].lastUsed").value(hasItem(DEFAULT_LAST_USED.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].cancelled").value(hasItem(DEFAULT_CANCELLED.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString())));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getSepaMandate() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get the sepaMandate
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates/{id}", sepaMandate.getId()))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.id").value(sepaMandate.getId().intValue()))
 | 
			
		||||
            .andExpect(jsonPath("$.reference").value(DEFAULT_REFERENCE.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.iban").value(DEFAULT_IBAN.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.bic").value(DEFAULT_BIC.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.created").value(DEFAULT_CREATED.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.validFrom").value(DEFAULT_VALID_FROM.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.validTo").value(DEFAULT_VALID_TO.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.lastUsed").value(DEFAULT_LAST_USED.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.cancelled").value(DEFAULT_CANCELLED.toString()))
 | 
			
		||||
            .andExpect(jsonPath("$.comment").value(DEFAULT_COMMENT.toString()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByReferenceIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where reference equals to DEFAULT_REFERENCE
 | 
			
		||||
        defaultSepaMandateShouldBeFound("reference.equals=" + DEFAULT_REFERENCE);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where reference equals to UPDATED_REFERENCE
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("reference.equals=" + UPDATED_REFERENCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByReferenceIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where reference in DEFAULT_REFERENCE or UPDATED_REFERENCE
 | 
			
		||||
        defaultSepaMandateShouldBeFound("reference.in=" + DEFAULT_REFERENCE + "," + UPDATED_REFERENCE);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where reference equals to UPDATED_REFERENCE
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("reference.in=" + UPDATED_REFERENCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByReferenceIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where reference is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("reference.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where reference is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("reference.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByIbanIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where iban equals to DEFAULT_IBAN
 | 
			
		||||
        defaultSepaMandateShouldBeFound("iban.equals=" + DEFAULT_IBAN);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where iban equals to UPDATED_IBAN
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("iban.equals=" + UPDATED_IBAN);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByIbanIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where iban in DEFAULT_IBAN or UPDATED_IBAN
 | 
			
		||||
        defaultSepaMandateShouldBeFound("iban.in=" + DEFAULT_IBAN + "," + UPDATED_IBAN);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where iban equals to UPDATED_IBAN
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("iban.in=" + UPDATED_IBAN);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByIbanIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where iban is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("iban.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where iban is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("iban.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByBicIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where bic equals to DEFAULT_BIC
 | 
			
		||||
        defaultSepaMandateShouldBeFound("bic.equals=" + DEFAULT_BIC);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where bic equals to UPDATED_BIC
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("bic.equals=" + UPDATED_BIC);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByBicIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where bic in DEFAULT_BIC or UPDATED_BIC
 | 
			
		||||
        defaultSepaMandateShouldBeFound("bic.in=" + DEFAULT_BIC + "," + UPDATED_BIC);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where bic equals to UPDATED_BIC
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("bic.in=" + UPDATED_BIC);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByBicIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where bic is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("bic.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where bic is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("bic.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCreatedIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created equals to DEFAULT_CREATED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("created.equals=" + DEFAULT_CREATED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created equals to UPDATED_CREATED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("created.equals=" + UPDATED_CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCreatedIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created in DEFAULT_CREATED or UPDATED_CREATED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("created.in=" + DEFAULT_CREATED + "," + UPDATED_CREATED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created equals to UPDATED_CREATED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("created.in=" + UPDATED_CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCreatedIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("created.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("created.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCreatedIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created greater than or equals to DEFAULT_CREATED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("created.greaterOrEqualThan=" + DEFAULT_CREATED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created greater than or equals to UPDATED_CREATED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("created.greaterOrEqualThan=" + UPDATED_CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCreatedIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created less than or equals to DEFAULT_CREATED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("created.lessThan=" + DEFAULT_CREATED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where created less than or equals to UPDATED_CREATED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("created.lessThan=" + UPDATED_CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidFromIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom equals to DEFAULT_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validFrom.equals=" + DEFAULT_VALID_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom equals to UPDATED_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validFrom.equals=" + UPDATED_VALID_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidFromIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom in DEFAULT_VALID_FROM or UPDATED_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validFrom.in=" + DEFAULT_VALID_FROM + "," + UPDATED_VALID_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom equals to UPDATED_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validFrom.in=" + UPDATED_VALID_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidFromIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validFrom.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validFrom.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidFromIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom greater than or equals to DEFAULT_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validFrom.greaterOrEqualThan=" + DEFAULT_VALID_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom greater than or equals to UPDATED_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validFrom.greaterOrEqualThan=" + UPDATED_VALID_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidFromIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom less than or equals to DEFAULT_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validFrom.lessThan=" + DEFAULT_VALID_FROM);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validFrom less than or equals to UPDATED_VALID_FROM
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validFrom.lessThan=" + UPDATED_VALID_FROM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidToIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo equals to DEFAULT_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validTo.equals=" + DEFAULT_VALID_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo equals to UPDATED_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validTo.equals=" + UPDATED_VALID_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidToIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo in DEFAULT_VALID_TO or UPDATED_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validTo.in=" + DEFAULT_VALID_TO + "," + UPDATED_VALID_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo equals to UPDATED_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validTo.in=" + UPDATED_VALID_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidToIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validTo.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validTo.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidToIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo greater than or equals to DEFAULT_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validTo.greaterOrEqualThan=" + DEFAULT_VALID_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo greater than or equals to UPDATED_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validTo.greaterOrEqualThan=" + UPDATED_VALID_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByValidToIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo less than or equals to DEFAULT_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("validTo.lessThan=" + DEFAULT_VALID_TO);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where validTo less than or equals to UPDATED_VALID_TO
 | 
			
		||||
        defaultSepaMandateShouldBeFound("validTo.lessThan=" + UPDATED_VALID_TO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByLastUsedIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed equals to DEFAULT_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("lastUsed.equals=" + DEFAULT_LAST_USED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed equals to UPDATED_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("lastUsed.equals=" + UPDATED_LAST_USED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByLastUsedIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed in DEFAULT_LAST_USED or UPDATED_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("lastUsed.in=" + DEFAULT_LAST_USED + "," + UPDATED_LAST_USED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed equals to UPDATED_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("lastUsed.in=" + UPDATED_LAST_USED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByLastUsedIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("lastUsed.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("lastUsed.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByLastUsedIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed greater than or equals to DEFAULT_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("lastUsed.greaterOrEqualThan=" + DEFAULT_LAST_USED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed greater than or equals to UPDATED_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("lastUsed.greaterOrEqualThan=" + UPDATED_LAST_USED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByLastUsedIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed less than or equals to DEFAULT_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("lastUsed.lessThan=" + DEFAULT_LAST_USED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where lastUsed less than or equals to UPDATED_LAST_USED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("lastUsed.lessThan=" + UPDATED_LAST_USED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCancelledIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled equals to DEFAULT_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("cancelled.equals=" + DEFAULT_CANCELLED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled equals to UPDATED_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("cancelled.equals=" + UPDATED_CANCELLED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCancelledIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled in DEFAULT_CANCELLED or UPDATED_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("cancelled.in=" + DEFAULT_CANCELLED + "," + UPDATED_CANCELLED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled equals to UPDATED_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("cancelled.in=" + UPDATED_CANCELLED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCancelledIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("cancelled.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("cancelled.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCancelledIsGreaterThanOrEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled greater than or equals to DEFAULT_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("cancelled.greaterOrEqualThan=" + DEFAULT_CANCELLED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled greater than or equals to UPDATED_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("cancelled.greaterOrEqualThan=" + UPDATED_CANCELLED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCancelledIsLessThanSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled less than or equals to DEFAULT_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("cancelled.lessThan=" + DEFAULT_CANCELLED);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where cancelled less than or equals to UPDATED_CANCELLED
 | 
			
		||||
        defaultSepaMandateShouldBeFound("cancelled.lessThan=" + UPDATED_CANCELLED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCommentIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where comment equals to DEFAULT_COMMENT
 | 
			
		||||
        defaultSepaMandateShouldBeFound("comment.equals=" + DEFAULT_COMMENT);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where comment equals to UPDATED_COMMENT
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("comment.equals=" + UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCommentIsInShouldWork() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where comment in DEFAULT_COMMENT or UPDATED_COMMENT
 | 
			
		||||
        defaultSepaMandateShouldBeFound("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where comment equals to UPDATED_COMMENT
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("comment.in=" + UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCommentIsNullOrNotNull() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where comment is not null
 | 
			
		||||
        defaultSepaMandateShouldBeFound("comment.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where comment is null
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("comment.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSepaMandatesByCustomerIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        sepaMandate.setCustomer(customer);
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
        Long customerId = customer.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where customer equals to customerId
 | 
			
		||||
        defaultSepaMandateShouldBeFound("customerId.equals=" + customerId);
 | 
			
		||||
 | 
			
		||||
        // Get all the sepaMandateList where customer equals to customerId + 1
 | 
			
		||||
        defaultSepaMandateShouldNotBeFound("customerId.equals=" + (customerId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is returned
 | 
			
		||||
     */
 | 
			
		||||
    private void defaultSepaMandateShouldBeFound(String filter) throws Exception {
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].id").value(hasItem(sepaMandate.getId().intValue())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].reference").value(hasItem(DEFAULT_REFERENCE)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].iban").value(hasItem(DEFAULT_IBAN)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].bic").value(hasItem(DEFAULT_BIC)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].created").value(hasItem(DEFAULT_CREATED.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].validFrom").value(hasItem(DEFAULT_VALID_FROM.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].validTo").value(hasItem(DEFAULT_VALID_TO.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].lastUsed").value(hasItem(DEFAULT_LAST_USED.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].cancelled").value(hasItem(DEFAULT_CANCELLED.toString())))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT)));
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 1
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates/count?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(content().string("1"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is not returned
 | 
			
		||||
     */
 | 
			
		||||
    private void defaultSepaMandateShouldNotBeFound(String filter) throws Exception {
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(jsonPath("$").isArray())
 | 
			
		||||
            .andExpect(jsonPath("$").isEmpty());
 | 
			
		||||
 | 
			
		||||
        // Check, that the count call also returns 0
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates/count?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
            .andExpect(content().string("0"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getNonExistingSepaMandate() throws Exception {
 | 
			
		||||
        // Get the sepaMandate
 | 
			
		||||
        restSepaMandateMockMvc.perform(get("/api/sepa-mandates/{id}", Long.MAX_VALUE))
 | 
			
		||||
            .andExpect(status().isNotFound());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void updateSepaMandate() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        int databaseSizeBeforeUpdate = sepaMandateRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Update the sepaMandate
 | 
			
		||||
        SepaMandate updatedSepaMandate = sepaMandateRepository.findById(sepaMandate.getId()).get();
 | 
			
		||||
        // Disconnect from session so that the updates on updatedSepaMandate are not directly saved in db
 | 
			
		||||
        em.detach(updatedSepaMandate);
 | 
			
		||||
        updatedSepaMandate
 | 
			
		||||
            .reference(UPDATED_REFERENCE)
 | 
			
		||||
            .iban(UPDATED_IBAN)
 | 
			
		||||
            .bic(UPDATED_BIC)
 | 
			
		||||
            .created(UPDATED_CREATED)
 | 
			
		||||
            .validFrom(UPDATED_VALID_FROM)
 | 
			
		||||
            .validTo(UPDATED_VALID_TO)
 | 
			
		||||
            .lastUsed(UPDATED_LAST_USED)
 | 
			
		||||
            .cancelled(UPDATED_CANCELLED)
 | 
			
		||||
            .comment(UPDATED_COMMENT);
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(updatedSepaMandate);
 | 
			
		||||
 | 
			
		||||
        restSepaMandateMockMvc.perform(put("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the SepaMandate in the database
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
        SepaMandate testSepaMandate = sepaMandateList.get(sepaMandateList.size() - 1);
 | 
			
		||||
        assertThat(testSepaMandate.getReference()).isEqualTo(UPDATED_REFERENCE);
 | 
			
		||||
        assertThat(testSepaMandate.getIban()).isEqualTo(UPDATED_IBAN);
 | 
			
		||||
        assertThat(testSepaMandate.getBic()).isEqualTo(UPDATED_BIC);
 | 
			
		||||
        assertThat(testSepaMandate.getCreated()).isEqualTo(UPDATED_CREATED);
 | 
			
		||||
        assertThat(testSepaMandate.getValidFrom()).isEqualTo(UPDATED_VALID_FROM);
 | 
			
		||||
        assertThat(testSepaMandate.getValidTo()).isEqualTo(UPDATED_VALID_TO);
 | 
			
		||||
        assertThat(testSepaMandate.getLastUsed()).isEqualTo(UPDATED_LAST_USED);
 | 
			
		||||
        assertThat(testSepaMandate.getCancelled()).isEqualTo(UPDATED_CANCELLED);
 | 
			
		||||
        assertThat(testSepaMandate.getComment()).isEqualTo(UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void updateNonExistingSepaMandate() throws Exception {
 | 
			
		||||
        int databaseSizeBeforeUpdate = sepaMandateRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Create the SepaMandate
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO = sepaMandateMapper.toDto(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        // If the entity doesn't have an ID, it will throw BadRequestAlertException
 | 
			
		||||
        restSepaMandateMockMvc.perform(put("/api/sepa-mandates")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(sepaMandateDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
 | 
			
		||||
        // Validate the SepaMandate in the database
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void deleteSepaMandate() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        sepaMandateRepository.saveAndFlush(sepaMandate);
 | 
			
		||||
 | 
			
		||||
        int databaseSizeBeforeDelete = sepaMandateRepository.findAll().size();
 | 
			
		||||
 | 
			
		||||
        // Delete the sepaMandate
 | 
			
		||||
        restSepaMandateMockMvc.perform(delete("/api/sepa-mandates/{id}", sepaMandate.getId())
 | 
			
		||||
            .accept(TestUtil.APPLICATION_JSON_UTF8))
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the database is empty
 | 
			
		||||
        List<SepaMandate> sepaMandateList = sepaMandateRepository.findAll();
 | 
			
		||||
        assertThat(sepaMandateList).hasSize(databaseSizeBeforeDelete - 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void equalsVerifier() throws Exception {
 | 
			
		||||
        TestUtil.equalsVerifier(SepaMandate.class);
 | 
			
		||||
        SepaMandate sepaMandate1 = new SepaMandate();
 | 
			
		||||
        sepaMandate1.setId(1L);
 | 
			
		||||
        SepaMandate sepaMandate2 = new SepaMandate();
 | 
			
		||||
        sepaMandate2.setId(sepaMandate1.getId());
 | 
			
		||||
        assertThat(sepaMandate1).isEqualTo(sepaMandate2);
 | 
			
		||||
        sepaMandate2.setId(2L);
 | 
			
		||||
        assertThat(sepaMandate1).isNotEqualTo(sepaMandate2);
 | 
			
		||||
        sepaMandate1.setId(null);
 | 
			
		||||
        assertThat(sepaMandate1).isNotEqualTo(sepaMandate2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void dtoEqualsVerifier() throws Exception {
 | 
			
		||||
        TestUtil.equalsVerifier(SepaMandateDTO.class);
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO1 = new SepaMandateDTO();
 | 
			
		||||
        sepaMandateDTO1.setId(1L);
 | 
			
		||||
        SepaMandateDTO sepaMandateDTO2 = new SepaMandateDTO();
 | 
			
		||||
        assertThat(sepaMandateDTO1).isNotEqualTo(sepaMandateDTO2);
 | 
			
		||||
        sepaMandateDTO2.setId(sepaMandateDTO1.getId());
 | 
			
		||||
        assertThat(sepaMandateDTO1).isEqualTo(sepaMandateDTO2);
 | 
			
		||||
        sepaMandateDTO2.setId(2L);
 | 
			
		||||
        assertThat(sepaMandateDTO1).isNotEqualTo(sepaMandateDTO2);
 | 
			
		||||
        sepaMandateDTO1.setId(null);
 | 
			
		||||
        assertThat(sepaMandateDTO1).isNotEqualTo(sepaMandateDTO2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void testEntityFromId() {
 | 
			
		||||
        assertThat(sepaMandateMapper.fromId(42L).getId()).isEqualTo(42);
 | 
			
		||||
        assertThat(sepaMandateMapper.fromId(null)).isNull();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,15 +1,17 @@
 | 
			
		||||
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.enumeration.ShareAction;
 | 
			
		||||
import org.hostsharing.hsadminng.domain.Membership;
 | 
			
		||||
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;
 | 
			
		||||
@@ -30,12 +32,14 @@ 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.
 | 
			
		||||
 *
 | 
			
		||||
@@ -51,11 +55,11 @@ public class ShareResourceIntTest {
 | 
			
		||||
    private static final ShareAction DEFAULT_ACTION = ShareAction.SUBSCRIPTION;
 | 
			
		||||
    private static final ShareAction UPDATED_ACTION = ShareAction.CANCELLATION;
 | 
			
		||||
 | 
			
		||||
    private static final Integer DEFAULT_QUANTITY = 2;
 | 
			
		||||
    private static final Integer UPDATED_QUANTITY = 3;
 | 
			
		||||
    private static final Integer DEFAULT_QUANTITY = 1;
 | 
			
		||||
    private static final Integer UPDATED_QUANTITY = 2;
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_COMMENT = "Some Comment";
 | 
			
		||||
    private static final String UPDATED_COMMENT = "Updated Comment";
 | 
			
		||||
    private static final String DEFAULT_COMMENT = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_COMMENT = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ShareRepository shareRepository;
 | 
			
		||||
@@ -102,24 +106,27 @@ public class ShareResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 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.
 | 
			
		||||
     */
 | 
			
		||||
    public static Share createEntity(final EntityManager em, final Membership membership) {
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
    public static Share createEntity(EntityManager em) {
 | 
			
		||||
        Share share = new Share()
 | 
			
		||||
            .member(membership)
 | 
			
		||||
            .date(DEFAULT_DATE)
 | 
			
		||||
            .action(DEFAULT_ACTION)
 | 
			
		||||
            .quantity(DEFAULT_QUANTITY)
 | 
			
		||||
            .comment(DEFAULT_COMMENT);
 | 
			
		||||
        // Add required entity
 | 
			
		||||
        Membership membership = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        share.setMembership(membership);
 | 
			
		||||
        return share;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        share = createEntity(em, MembershipResourceIntTest.createEntity(em));
 | 
			
		||||
        share = createEntity(em);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -237,7 +244,7 @@ public class ShareResourceIntTest {
 | 
			
		||||
            .andExpect(jsonPath("$.[*].quantity").value(hasItem(DEFAULT_QUANTITY)))
 | 
			
		||||
            .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString())));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getShare() throws Exception {
 | 
			
		||||
@@ -262,10 +269,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date equals to DEFAULT_DATE
 | 
			
		||||
        shouldFindDefaultShare("date.equals=" + DEFAULT_DATE);
 | 
			
		||||
        defaultShareShouldBeFound("date.equals=" + DEFAULT_DATE);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date equals to UPDATED_DATE
 | 
			
		||||
        shouldNotFindAnyShare("date.equals=" + UPDATED_DATE);
 | 
			
		||||
        defaultShareShouldNotBeFound("date.equals=" + UPDATED_DATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -275,10 +282,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date in DEFAULT_DATE or UPDATED_DATE
 | 
			
		||||
        shouldFindDefaultShare("date.in=" + DEFAULT_DATE + "," + UPDATED_DATE);
 | 
			
		||||
        defaultShareShouldBeFound("date.in=" + DEFAULT_DATE + "," + UPDATED_DATE);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date equals to UPDATED_DATE
 | 
			
		||||
        shouldNotFindAnyShare("date.in=" + UPDATED_DATE);
 | 
			
		||||
        defaultShareShouldNotBeFound("date.in=" + UPDATED_DATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -288,10 +295,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date is not null
 | 
			
		||||
        shouldFindDefaultShare("date.specified=true");
 | 
			
		||||
        defaultShareShouldBeFound("date.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date is null
 | 
			
		||||
        shouldNotFindAnyShare("date.specified=false");
 | 
			
		||||
        defaultShareShouldNotBeFound("date.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -301,10 +308,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date greater than or equals to DEFAULT_DATE
 | 
			
		||||
        shouldFindDefaultShare("date.greaterOrEqualThan=" + DEFAULT_DATE);
 | 
			
		||||
        defaultShareShouldBeFound("date.greaterOrEqualThan=" + DEFAULT_DATE);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date greater than or equals to UPDATED_DATE
 | 
			
		||||
        shouldNotFindAnyShare("date.greaterOrEqualThan=" + UPDATED_DATE);
 | 
			
		||||
        defaultShareShouldNotBeFound("date.greaterOrEqualThan=" + UPDATED_DATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -314,10 +321,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date less than or equals to DEFAULT_DATE
 | 
			
		||||
        shouldNotFindAnyShare("date.lessThan=" + DEFAULT_DATE);
 | 
			
		||||
        defaultShareShouldNotBeFound("date.lessThan=" + DEFAULT_DATE);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where date less than or equals to UPDATED_DATE
 | 
			
		||||
        shouldFindDefaultShare("date.lessThan=" + UPDATED_DATE);
 | 
			
		||||
        defaultShareShouldBeFound("date.lessThan=" + UPDATED_DATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -328,10 +335,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where action equals to DEFAULT_ACTION
 | 
			
		||||
        shouldFindDefaultShare("action.equals=" + DEFAULT_ACTION);
 | 
			
		||||
        defaultShareShouldBeFound("action.equals=" + DEFAULT_ACTION);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where action equals to UPDATED_ACTION
 | 
			
		||||
        shouldNotFindAnyShare("action.equals=" + UPDATED_ACTION);
 | 
			
		||||
        defaultShareShouldNotBeFound("action.equals=" + UPDATED_ACTION);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -341,10 +348,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where action in DEFAULT_ACTION or UPDATED_ACTION
 | 
			
		||||
        shouldFindDefaultShare("action.in=" + DEFAULT_ACTION + "," + UPDATED_ACTION);
 | 
			
		||||
        defaultShareShouldBeFound("action.in=" + DEFAULT_ACTION + "," + UPDATED_ACTION);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where action equals to UPDATED_ACTION
 | 
			
		||||
        shouldNotFindAnyShare("action.in=" + UPDATED_ACTION);
 | 
			
		||||
        defaultShareShouldNotBeFound("action.in=" + UPDATED_ACTION);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -354,10 +361,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where action is not null
 | 
			
		||||
        shouldFindDefaultShare("action.specified=true");
 | 
			
		||||
        defaultShareShouldBeFound("action.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where action is null
 | 
			
		||||
        shouldNotFindAnyShare("action.specified=false");
 | 
			
		||||
        defaultShareShouldNotBeFound("action.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -367,11 +374,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity equals to DEFAULT_QUANTITY
 | 
			
		||||
        shouldFindDefaultShare("quantity.equals=" + DEFAULT_QUANTITY);
 | 
			
		||||
        defaultShareShouldBeFound("quantity.equals=" + DEFAULT_QUANTITY);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity is not in database
 | 
			
		||||
        shouldNotFindAnyShare("quantity.equals=" + (DEFAULT_QUANTITY + 1));
 | 
			
		||||
        shouldNotFindAnyShare("quantity.equals=" + (-DEFAULT_QUANTITY));
 | 
			
		||||
        // Get all the shareList where quantity equals to UPDATED_QUANTITY
 | 
			
		||||
        defaultShareShouldNotBeFound("quantity.equals=" + UPDATED_QUANTITY);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -381,10 +387,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity in DEFAULT_QUANTITY or UPDATED_QUANTITY
 | 
			
		||||
        shouldFindDefaultShare("quantity.in=" + DEFAULT_QUANTITY + "," + (-DEFAULT_QUANTITY));
 | 
			
		||||
        defaultShareShouldBeFound("quantity.in=" + DEFAULT_QUANTITY + "," + UPDATED_QUANTITY);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity equals to UPDATED_QUANTITY
 | 
			
		||||
        shouldNotFindAnyShare("quantity.in=" + (DEFAULT_QUANTITY + 1));
 | 
			
		||||
        defaultShareShouldNotBeFound("quantity.in=" + UPDATED_QUANTITY);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -394,10 +400,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity is not null
 | 
			
		||||
        shouldFindDefaultShare("quantity.specified=true");
 | 
			
		||||
        defaultShareShouldBeFound("quantity.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity is null
 | 
			
		||||
        shouldNotFindAnyShare("quantity.specified=false");
 | 
			
		||||
        defaultShareShouldNotBeFound("quantity.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -407,10 +413,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity greater than or equals to DEFAULT_QUANTITY
 | 
			
		||||
        shouldFindDefaultShare("quantity.greaterOrEqualThan=" + DEFAULT_QUANTITY);
 | 
			
		||||
        defaultShareShouldBeFound("quantity.greaterOrEqualThan=" + DEFAULT_QUANTITY);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity greater than or equals to DEFAULT_QUANTITY+1
 | 
			
		||||
        shouldNotFindAnyShare("quantity.greaterOrEqualThan=" + (DEFAULT_QUANTITY + 1));
 | 
			
		||||
        // Get all the shareList where quantity greater than or equals to UPDATED_QUANTITY
 | 
			
		||||
        defaultShareShouldNotBeFound("quantity.greaterOrEqualThan=" + UPDATED_QUANTITY);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -420,10 +426,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity less than or equals to DEFAULT_QUANTITY
 | 
			
		||||
        shouldNotFindAnyShare("quantity.lessThan=" + DEFAULT_QUANTITY);
 | 
			
		||||
        defaultShareShouldNotBeFound("quantity.lessThan=" + DEFAULT_QUANTITY);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where quantity less than or equals to DEFAULT_QUANTITY-1
 | 
			
		||||
        shouldFindDefaultShare("quantity.lessThan=" + (DEFAULT_QUANTITY + 1));
 | 
			
		||||
        // Get all the shareList where quantity less than or equals to UPDATED_QUANTITY
 | 
			
		||||
        defaultShareShouldBeFound("quantity.lessThan=" + UPDATED_QUANTITY);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -434,10 +440,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where comment equals to DEFAULT_COMMENT
 | 
			
		||||
        shouldFindDefaultShare("comment.equals=" + DEFAULT_COMMENT);
 | 
			
		||||
        defaultShareShouldBeFound("comment.equals=" + DEFAULT_COMMENT);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where comment equals to UPDATED_COMMENT
 | 
			
		||||
        shouldNotFindAnyShare("comment.equals=" + UPDATED_COMMENT);
 | 
			
		||||
        defaultShareShouldNotBeFound("comment.equals=" + UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -447,10 +453,10 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where comment in DEFAULT_COMMENT or UPDATED_COMMENT
 | 
			
		||||
        shouldFindDefaultShare("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);
 | 
			
		||||
        defaultShareShouldBeFound("comment.in=" + DEFAULT_COMMENT + "," + UPDATED_COMMENT);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where comment equals to UPDATED_COMMENT
 | 
			
		||||
        shouldNotFindAnyShare("comment.in=" + UPDATED_COMMENT);
 | 
			
		||||
        defaultShareShouldNotBeFound("comment.in=" + UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -460,34 +466,34 @@ public class ShareResourceIntTest {
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where comment is not null
 | 
			
		||||
        shouldFindDefaultShare("comment.specified=true");
 | 
			
		||||
        defaultShareShouldBeFound("comment.specified=true");
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where comment is null
 | 
			
		||||
        shouldNotFindAnyShare("comment.specified=false");
 | 
			
		||||
        defaultShareShouldNotBeFound("comment.specified=false");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSharesByMemberIsEqualToSomething() throws Exception {
 | 
			
		||||
    public void getAllSharesByMembershipIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Membership member = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(member);
 | 
			
		||||
        Membership membership = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        share.setMember(member);
 | 
			
		||||
        share.setMembership(membership);
 | 
			
		||||
        shareRepository.saveAndFlush(share);
 | 
			
		||||
        Long memberId = member.getId();
 | 
			
		||||
        Long membershipId = membership.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where member equals to memberId
 | 
			
		||||
        shouldFindDefaultShare("memberId.equals=" + memberId);
 | 
			
		||||
        // Get all the shareList where membership equals to membershipId
 | 
			
		||||
        defaultShareShouldBeFound("membershipId.equals=" + membershipId);
 | 
			
		||||
 | 
			
		||||
        // Get all the shareList where member equals to memberId + 1
 | 
			
		||||
        shouldNotFindAnyShare("memberId.equals=" + (memberId + 1));
 | 
			
		||||
        // Get all the shareList where membership equals to membershipId + 1
 | 
			
		||||
        defaultShareShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is returned
 | 
			
		||||
     */
 | 
			
		||||
    private void shouldFindDefaultShare(String filter) throws Exception {
 | 
			
		||||
    private void defaultShareShouldBeFound(String filter) throws Exception {
 | 
			
		||||
        restShareMockMvc.perform(get("/api/shares?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
@@ -507,7 +513,7 @@ public class ShareResourceIntTest {
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the search, and checks that the default entity is not returned
 | 
			
		||||
     */
 | 
			
		||||
    private void shouldNotFindAnyShare(String filter) throws Exception {
 | 
			
		||||
    private void defaultShareShouldNotBeFound(String filter) throws Exception {
 | 
			
		||||
        restShareMockMvc.perform(get("/api/shares?sort=id,desc&" + filter))
 | 
			
		||||
            .andExpect(status().isOk())
 | 
			
		||||
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
 | 
			
		||||
@@ -552,16 +558,16 @@ public class ShareResourceIntTest {
 | 
			
		||||
        restShareMockMvc.perform(put("/api/shares")
 | 
			
		||||
            .contentType(TestUtil.APPLICATION_JSON_UTF8)
 | 
			
		||||
            .content(TestUtil.convertObjectToJsonBytes(shareDTO)))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the Share in the database
 | 
			
		||||
        List<Share> shareList = shareRepository.findAll();
 | 
			
		||||
        assertThat(shareList).hasSize(databaseSizeBeforeUpdate);
 | 
			
		||||
        Share testShare = shareList.get(shareList.size() - 1);
 | 
			
		||||
        assertThat(testShare.getDate()).isEqualTo(DEFAULT_DATE);
 | 
			
		||||
        assertThat(testShare.getAction()).isEqualTo(DEFAULT_ACTION);
 | 
			
		||||
        assertThat(testShare.getQuantity()).isEqualTo(DEFAULT_QUANTITY);
 | 
			
		||||
        assertThat(testShare.getComment()).isEqualTo(DEFAULT_COMMENT);
 | 
			
		||||
        assertThat(testShare.getDate()).isEqualTo(UPDATED_DATE);
 | 
			
		||||
        assertThat(testShare.getAction()).isEqualTo(UPDATED_ACTION);
 | 
			
		||||
        assertThat(testShare.getQuantity()).isEqualTo(UPDATED_QUANTITY);
 | 
			
		||||
        assertThat(testShare.getComment()).isEqualTo(UPDATED_COMMENT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -594,11 +600,11 @@ public class ShareResourceIntTest {
 | 
			
		||||
        // Delete the share
 | 
			
		||||
        restShareMockMvc.perform(delete("/api/shares/{id}", share.getId())
 | 
			
		||||
            .accept(TestUtil.APPLICATION_JSON_UTF8))
 | 
			
		||||
            .andExpect(status().isBadRequest());
 | 
			
		||||
            .andExpect(status().isOk());
 | 
			
		||||
 | 
			
		||||
        // Validate the share is still in the database
 | 
			
		||||
        // Validate the database is empty
 | 
			
		||||
        List<Share> shareList = shareRepository.findAll();
 | 
			
		||||
        assertThat(shareList).hasSize(databaseSizeBeforeDelete);
 | 
			
		||||
        assertThat(shareList).hasSize(databaseSizeBeforeDelete - 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
 | 
			
		||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { AssetUpdateComponent } from 'app/entities/asset/asset-update.component';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,108 +0,0 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { TestBed, getTestBed } 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 { ContactService } from 'app/entities/contact/contact.service';
 | 
			
		||||
import { IContact, Contact } from 'app/shared/model/contact.model';
 | 
			
		||||
 | 
			
		||||
describe('Service Tests', () => {
 | 
			
		||||
    describe('Contact Service', () => {
 | 
			
		||||
        let injector: TestBed;
 | 
			
		||||
        let service: ContactService;
 | 
			
		||||
        let httpMock: HttpTestingController;
 | 
			
		||||
        let elemDefault: IContact;
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HttpClientTestingModule]
 | 
			
		||||
            });
 | 
			
		||||
            injector = getTestBed();
 | 
			
		||||
            service = injector.get(ContactService);
 | 
			
		||||
            httpMock = injector.get(HttpTestingController);
 | 
			
		||||
 | 
			
		||||
            elemDefault = new Contact(0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('Service methods', async () => {
 | 
			
		||||
            it('should find an element', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign({}, elemDefault);
 | 
			
		||||
                service
 | 
			
		||||
                    .find(123)
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: elemDefault }));
 | 
			
		||||
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'GET' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should create a Contact', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        id: 0
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign({}, returnedFromService);
 | 
			
		||||
                service
 | 
			
		||||
                    .create(new Contact(null))
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: expected }));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'POST' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should update a Contact', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        firstName: 'BBBBBB',
 | 
			
		||||
                        lastName: 'BBBBBB',
 | 
			
		||||
                        email: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                const expected = Object.assign({}, returnedFromService);
 | 
			
		||||
                service
 | 
			
		||||
                    .update(expected)
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: expected }));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'PUT' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should return a list of Contact', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        firstName: 'BBBBBB',
 | 
			
		||||
                        lastName: 'BBBBBB',
 | 
			
		||||
                        email: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign({}, returnedFromService);
 | 
			
		||||
                service
 | 
			
		||||
                    .query(expected)
 | 
			
		||||
                    .pipe(
 | 
			
		||||
                        take(1),
 | 
			
		||||
                        map(resp => resp.body)
 | 
			
		||||
                    )
 | 
			
		||||
                    .subscribe(body => expect(body).toContainEqual(expected));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'GET' });
 | 
			
		||||
                req.flush(JSON.stringify([returnedFromService]));
 | 
			
		||||
                httpMock.verify();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should delete a Contact', async () => {
 | 
			
		||||
                const rxPromise = service.delete(123).subscribe(resp => expect(resp.ok));
 | 
			
		||||
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'DELETE' });
 | 
			
		||||
                req.flush({ status: 200 });
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        afterEach(() => {
 | 
			
		||||
            httpMock.verify();
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,52 +0,0 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
import { JhiEventManager } from 'ng-jhipster';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { CustomerContactDeleteDialogComponent } from 'app/entities/customer-contact/customer-contact-delete-dialog.component';
 | 
			
		||||
import { CustomerContactService } from 'app/entities/customer-contact/customer-contact.service';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('CustomerContact Management Delete Component', () => {
 | 
			
		||||
        let comp: CustomerContactDeleteDialogComponent;
 | 
			
		||||
        let fixture: ComponentFixture<CustomerContactDeleteDialogComponent>;
 | 
			
		||||
        let service: CustomerContactService;
 | 
			
		||||
        let mockEventManager: any;
 | 
			
		||||
        let mockActiveModal: any;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [CustomerContactDeleteDialogComponent]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(CustomerContactDeleteDialogComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
            fixture = TestBed.createComponent(CustomerContactDeleteDialogComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
            service = fixture.debugElement.injector.get(CustomerContactService);
 | 
			
		||||
            mockEventManager = fixture.debugElement.injector.get(JhiEventManager);
 | 
			
		||||
            mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('confirmDelete', () => {
 | 
			
		||||
            it('Should call delete service on confirmDelete', inject(
 | 
			
		||||
                [],
 | 
			
		||||
                fakeAsync(() => {
 | 
			
		||||
                    // GIVEN
 | 
			
		||||
                    spyOn(service, 'delete').and.returnValue(of({}));
 | 
			
		||||
 | 
			
		||||
                    // WHEN
 | 
			
		||||
                    comp.confirmDelete(123);
 | 
			
		||||
                    tick();
 | 
			
		||||
 | 
			
		||||
                    // THEN
 | 
			
		||||
                    expect(service.delete).toHaveBeenCalledWith(123);
 | 
			
		||||
                    expect(mockActiveModal.dismissSpy).toHaveBeenCalled();
 | 
			
		||||
                    expect(mockEventManager.broadcastSpy).toHaveBeenCalled();
 | 
			
		||||
                })
 | 
			
		||||
            ));
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
import { ActivatedRoute } from '@angular/router';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { CustomerContactDetailComponent } from 'app/entities/customer-contact/customer-contact-detail.component';
 | 
			
		||||
import { CustomerContact } from 'app/shared/model/customer-contact.model';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('CustomerContact Management Detail Component', () => {
 | 
			
		||||
        let comp: CustomerContactDetailComponent;
 | 
			
		||||
        let fixture: ComponentFixture<CustomerContactDetailComponent>;
 | 
			
		||||
        const route = ({ data: of({ customerContact: new CustomerContact(123) }) } as any) as ActivatedRoute;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [CustomerContactDetailComponent],
 | 
			
		||||
                providers: [{ provide: ActivatedRoute, useValue: route }]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(CustomerContactDetailComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
            fixture = TestBed.createComponent(CustomerContactDetailComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('OnInit', () => {
 | 
			
		||||
            it('Should call load all on init', () => {
 | 
			
		||||
                // GIVEN
 | 
			
		||||
 | 
			
		||||
                // WHEN
 | 
			
		||||
                comp.ngOnInit();
 | 
			
		||||
 | 
			
		||||
                // THEN
 | 
			
		||||
                expect(comp.customerContact).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,60 +0,0 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { CustomerContactUpdateComponent } from 'app/entities/customer-contact/customer-contact-update.component';
 | 
			
		||||
import { CustomerContactService } from 'app/entities/customer-contact/customer-contact.service';
 | 
			
		||||
import { CustomerContact } from 'app/shared/model/customer-contact.model';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('CustomerContact Management Update Component', () => {
 | 
			
		||||
        let comp: CustomerContactUpdateComponent;
 | 
			
		||||
        let fixture: ComponentFixture<CustomerContactUpdateComponent>;
 | 
			
		||||
        let service: CustomerContactService;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [CustomerContactUpdateComponent]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(CustomerContactUpdateComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
 | 
			
		||||
            fixture = TestBed.createComponent(CustomerContactUpdateComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
            service = fixture.debugElement.injector.get(CustomerContactService);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('save', () => {
 | 
			
		||||
            it('Should call update service on save for existing entity', fakeAsync(() => {
 | 
			
		||||
                // GIVEN
 | 
			
		||||
                const entity = new CustomerContact(123);
 | 
			
		||||
                spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
 | 
			
		||||
                comp.customerContact = entity;
 | 
			
		||||
                // WHEN
 | 
			
		||||
                comp.save();
 | 
			
		||||
                tick(); // simulate async
 | 
			
		||||
 | 
			
		||||
                // THEN
 | 
			
		||||
                expect(service.update).toHaveBeenCalledWith(entity);
 | 
			
		||||
                expect(comp.isSaving).toEqual(false);
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
            it('Should call create service on save for new entity', fakeAsync(() => {
 | 
			
		||||
                // GIVEN
 | 
			
		||||
                const entity = new CustomerContact();
 | 
			
		||||
                spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
 | 
			
		||||
                comp.customerContact = entity;
 | 
			
		||||
                // WHEN
 | 
			
		||||
                comp.save();
 | 
			
		||||
                tick(); // simulate async
 | 
			
		||||
 | 
			
		||||
                // THEN
 | 
			
		||||
                expect(service.create).toHaveBeenCalledWith(entity);
 | 
			
		||||
                expect(comp.isSaving).toEqual(false);
 | 
			
		||||
            }));
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,128 +0,0 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
import { HttpHeaders, HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { ActivatedRoute, Data } from '@angular/router';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { CustomerContactComponent } from 'app/entities/customer-contact/customer-contact.component';
 | 
			
		||||
import { CustomerContactService } from 'app/entities/customer-contact/customer-contact.service';
 | 
			
		||||
import { CustomerContact } from 'app/shared/model/customer-contact.model';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('CustomerContact Management Component', () => {
 | 
			
		||||
        let comp: CustomerContactComponent;
 | 
			
		||||
        let fixture: ComponentFixture<CustomerContactComponent>;
 | 
			
		||||
        let service: CustomerContactService;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [CustomerContactComponent],
 | 
			
		||||
                providers: [
 | 
			
		||||
                    {
 | 
			
		||||
                        provide: ActivatedRoute,
 | 
			
		||||
                        useValue: {
 | 
			
		||||
                            data: {
 | 
			
		||||
                                subscribe: (fn: (value: Data) => void) =>
 | 
			
		||||
                                    fn({
 | 
			
		||||
                                        pagingParams: {
 | 
			
		||||
                                            predicate: 'id',
 | 
			
		||||
                                            reverse: false,
 | 
			
		||||
                                            page: 0
 | 
			
		||||
                                        }
 | 
			
		||||
                                    })
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(CustomerContactComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
 | 
			
		||||
            fixture = TestBed.createComponent(CustomerContactComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
            service = fixture.debugElement.injector.get(CustomerContactService);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('Should call load all on init', () => {
 | 
			
		||||
            // GIVEN
 | 
			
		||||
            const headers = new HttpHeaders().append('link', 'link;link');
 | 
			
		||||
            spyOn(service, 'query').and.returnValue(
 | 
			
		||||
                of(
 | 
			
		||||
                    new HttpResponse({
 | 
			
		||||
                        body: [new CustomerContact(123)],
 | 
			
		||||
                        headers
 | 
			
		||||
                    })
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            // WHEN
 | 
			
		||||
            comp.ngOnInit();
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(service.query).toHaveBeenCalled();
 | 
			
		||||
            expect(comp.customerContacts[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should load a page', () => {
 | 
			
		||||
            // GIVEN
 | 
			
		||||
            const headers = new HttpHeaders().append('link', 'link;link');
 | 
			
		||||
            spyOn(service, 'query').and.returnValue(
 | 
			
		||||
                of(
 | 
			
		||||
                    new HttpResponse({
 | 
			
		||||
                        body: [new CustomerContact(123)],
 | 
			
		||||
                        headers
 | 
			
		||||
                    })
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            // WHEN
 | 
			
		||||
            comp.loadPage(1);
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(service.query).toHaveBeenCalled();
 | 
			
		||||
            expect(comp.customerContacts[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should re-initialize the page', () => {
 | 
			
		||||
            // GIVEN
 | 
			
		||||
            const headers = new HttpHeaders().append('link', 'link;link');
 | 
			
		||||
            spyOn(service, 'query').and.returnValue(
 | 
			
		||||
                of(
 | 
			
		||||
                    new HttpResponse({
 | 
			
		||||
                        body: [new CustomerContact(123)],
 | 
			
		||||
                        headers
 | 
			
		||||
                    })
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            // WHEN
 | 
			
		||||
            comp.loadPage(1);
 | 
			
		||||
            comp.reset();
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(comp.page).toEqual(0);
 | 
			
		||||
            expect(service.query).toHaveBeenCalledTimes(2);
 | 
			
		||||
            expect(comp.customerContacts[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
        });
 | 
			
		||||
        it('should calculate the sort attribute for an id', () => {
 | 
			
		||||
            // WHEN
 | 
			
		||||
            const result = comp.sort();
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(result).toEqual(['id,asc']);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should calculate the sort attribute for a non-id attribute', () => {
 | 
			
		||||
            // GIVEN
 | 
			
		||||
            comp.predicate = 'name';
 | 
			
		||||
 | 
			
		||||
            // WHEN
 | 
			
		||||
            const result = comp.sort();
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(result).toEqual(['name,asc', 'id']);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,104 +0,0 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { TestBed, getTestBed } 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 { CustomerContactService } from 'app/entities/customer-contact/customer-contact.service';
 | 
			
		||||
import { ICustomerContact, CustomerContact, CustomerContactRole } from 'app/shared/model/customer-contact.model';
 | 
			
		||||
 | 
			
		||||
describe('Service Tests', () => {
 | 
			
		||||
    describe('CustomerContact Service', () => {
 | 
			
		||||
        let injector: TestBed;
 | 
			
		||||
        let service: CustomerContactService;
 | 
			
		||||
        let httpMock: HttpTestingController;
 | 
			
		||||
        let elemDefault: ICustomerContact;
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HttpClientTestingModule]
 | 
			
		||||
            });
 | 
			
		||||
            injector = getTestBed();
 | 
			
		||||
            service = injector.get(CustomerContactService);
 | 
			
		||||
            httpMock = injector.get(HttpTestingController);
 | 
			
		||||
 | 
			
		||||
            elemDefault = new CustomerContact(0, CustomerContactRole.CONTRACTUAL);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('Service methods', async () => {
 | 
			
		||||
            it('should find an element', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign({}, elemDefault);
 | 
			
		||||
                service
 | 
			
		||||
                    .find(123)
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: elemDefault }));
 | 
			
		||||
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'GET' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should create a CustomerContact', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        id: 0
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign({}, returnedFromService);
 | 
			
		||||
                service
 | 
			
		||||
                    .create(new CustomerContact(null))
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: expected }));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'POST' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should update a CustomerContact', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        role: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                const expected = Object.assign({}, returnedFromService);
 | 
			
		||||
                service
 | 
			
		||||
                    .update(expected)
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: expected }));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'PUT' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should return a list of CustomerContact', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        role: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign({}, returnedFromService);
 | 
			
		||||
                service
 | 
			
		||||
                    .query(expected)
 | 
			
		||||
                    .pipe(
 | 
			
		||||
                        take(1),
 | 
			
		||||
                        map(resp => resp.body)
 | 
			
		||||
                    )
 | 
			
		||||
                    .subscribe(body => expect(body).toContainEqual(expected));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'GET' });
 | 
			
		||||
                req.flush(JSON.stringify([returnedFromService]));
 | 
			
		||||
                httpMock.verify();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should delete a CustomerContact', async () => {
 | 
			
		||||
                const rxPromise = service.delete(123).subscribe(resp => expect(resp.ok));
 | 
			
		||||
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'DELETE' });
 | 
			
		||||
                req.flush({ status: 200 });
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        afterEach(() => {
 | 
			
		||||
            httpMock.verify();
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
 | 
			
		||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { CustomerUpdateComponent } from 'app/entities/customer/customer-update.component';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,11 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { getTestBed, TestBed } from '@angular/core/testing';
 | 
			
		||||
import { TestBed, getTestBed } from '@angular/core/testing';
 | 
			
		||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
 | 
			
		||||
import { map, take } from 'rxjs/operators';
 | 
			
		||||
import { HttpClient, HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { take, map } from 'rxjs/operators';
 | 
			
		||||
import { CustomerService } from 'app/entities/customer/customer.service';
 | 
			
		||||
import { Customer, ICustomer } from 'app/shared/model/customer.model';
 | 
			
		||||
import { ICustomer, Customer } from 'app/shared/model/customer.model';
 | 
			
		||||
 | 
			
		||||
describe('Service Tests', () => {
 | 
			
		||||
    describe('Customer Service', () => {
 | 
			
		||||
@@ -56,10 +58,10 @@ describe('Service Tests', () => {
 | 
			
		||||
                        number: 1,
 | 
			
		||||
                        prefix: 'BBBBBB',
 | 
			
		||||
                        name: 'BBBBBB',
 | 
			
		||||
                        contractualAddress: 'BBBBBB',
 | 
			
		||||
                        contractualSalutation: 'BBBBBB',
 | 
			
		||||
                        billingAddress: 'BBBBBB',
 | 
			
		||||
                        billingSalutation: 'BBBBBB'
 | 
			
		||||
                        contractualAddress: 'BBBBBB',
 | 
			
		||||
                        billingSalutation: 'BBBBBB',
 | 
			
		||||
                        billingAddress: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
@@ -79,10 +81,10 @@ describe('Service Tests', () => {
 | 
			
		||||
                        number: 1,
 | 
			
		||||
                        prefix: 'BBBBBB',
 | 
			
		||||
                        name: 'BBBBBB',
 | 
			
		||||
                        contractualAddress: 'BBBBBB',
 | 
			
		||||
                        contractualSalutation: 'BBBBBB',
 | 
			
		||||
                        billingAddress: 'BBBBBB',
 | 
			
		||||
                        billingSalutation: 'BBBBBB'
 | 
			
		||||
                        contractualAddress: 'BBBBBB',
 | 
			
		||||
                        billingSalutation: 'BBBBBB',
 | 
			
		||||
                        billingAddress: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
 | 
			
		||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { MembershipUpdateComponent } from 'app/entities/membership/membership-update.component';
 | 
			
		||||
 
 | 
			
		||||
@@ -25,15 +25,15 @@ describe('Service Tests', () => {
 | 
			
		||||
            httpMock = injector.get(HttpTestingController);
 | 
			
		||||
            currentDate = moment();
 | 
			
		||||
 | 
			
		||||
            elemDefault = new Membership(0, currentDate, currentDate);
 | 
			
		||||
            elemDefault = new Membership(0, currentDate, currentDate, 'AAAAAAA');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('Service methods', async () => {
 | 
			
		||||
            it('should find an element', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        sinceDate: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        untilDate: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                        from: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        to: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
@@ -50,15 +50,15 @@ describe('Service Tests', () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        id: 0,
 | 
			
		||||
                        sinceDate: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        untilDate: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                        from: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        to: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        sinceDate: currentDate,
 | 
			
		||||
                        untilDate: currentDate
 | 
			
		||||
                        from: currentDate,
 | 
			
		||||
                        to: currentDate
 | 
			
		||||
                    },
 | 
			
		||||
                    returnedFromService
 | 
			
		||||
                );
 | 
			
		||||
@@ -73,16 +73,17 @@ describe('Service Tests', () => {
 | 
			
		||||
            it('should update a Membership', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        sinceDate: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        untilDate: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                        from: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        to: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        comment: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                const expected = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        sinceDate: currentDate,
 | 
			
		||||
                        untilDate: currentDate
 | 
			
		||||
                        from: currentDate,
 | 
			
		||||
                        to: currentDate
 | 
			
		||||
                    },
 | 
			
		||||
                    returnedFromService
 | 
			
		||||
                );
 | 
			
		||||
@@ -97,15 +98,16 @@ describe('Service Tests', () => {
 | 
			
		||||
            it('should return a list of Membership', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        sinceDate: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        untilDate: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                        from: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        to: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        comment: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        sinceDate: currentDate,
 | 
			
		||||
                        untilDate: currentDate
 | 
			
		||||
                        from: currentDate,
 | 
			
		||||
                        to: currentDate
 | 
			
		||||
                    },
 | 
			
		||||
                    returnedFromService
 | 
			
		||||
                );
 | 
			
		||||
 
 | 
			
		||||
@@ -5,27 +5,27 @@ import { Observable, of } from 'rxjs';
 | 
			
		||||
import { JhiEventManager } from 'ng-jhipster';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { ContactDeleteDialogComponent } from 'app/entities/contact/contact-delete-dialog.component';
 | 
			
		||||
import { ContactService } from 'app/entities/contact/contact.service';
 | 
			
		||||
import { SepaMandateDeleteDialogComponent } from 'app/entities/sepa-mandate/sepa-mandate-delete-dialog.component';
 | 
			
		||||
import { SepaMandateService } from 'app/entities/sepa-mandate/sepa-mandate.service';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('Contact Management Delete Component', () => {
 | 
			
		||||
        let comp: ContactDeleteDialogComponent;
 | 
			
		||||
        let fixture: ComponentFixture<ContactDeleteDialogComponent>;
 | 
			
		||||
        let service: ContactService;
 | 
			
		||||
    describe('SepaMandate Management Delete Component', () => {
 | 
			
		||||
        let comp: SepaMandateDeleteDialogComponent;
 | 
			
		||||
        let fixture: ComponentFixture<SepaMandateDeleteDialogComponent>;
 | 
			
		||||
        let service: SepaMandateService;
 | 
			
		||||
        let mockEventManager: any;
 | 
			
		||||
        let mockActiveModal: any;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [ContactDeleteDialogComponent]
 | 
			
		||||
                declarations: [SepaMandateDeleteDialogComponent]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(ContactDeleteDialogComponent, '')
 | 
			
		||||
                .overrideTemplate(SepaMandateDeleteDialogComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
            fixture = TestBed.createComponent(ContactDeleteDialogComponent);
 | 
			
		||||
            fixture = TestBed.createComponent(SepaMandateDeleteDialogComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
            service = fixture.debugElement.injector.get(ContactService);
 | 
			
		||||
            service = fixture.debugElement.injector.get(SepaMandateService);
 | 
			
		||||
            mockEventManager = fixture.debugElement.injector.get(JhiEventManager);
 | 
			
		||||
            mockActiveModal = fixture.debugElement.injector.get(NgbActiveModal);
 | 
			
		||||
        });
 | 
			
		||||
@@ -4,24 +4,24 @@ import { ActivatedRoute } from '@angular/router';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { ContactDetailComponent } from 'app/entities/contact/contact-detail.component';
 | 
			
		||||
import { Contact } from 'app/shared/model/contact.model';
 | 
			
		||||
import { SepaMandateDetailComponent } from 'app/entities/sepa-mandate/sepa-mandate-detail.component';
 | 
			
		||||
import { SepaMandate } from 'app/shared/model/sepa-mandate.model';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('Contact Management Detail Component', () => {
 | 
			
		||||
        let comp: ContactDetailComponent;
 | 
			
		||||
        let fixture: ComponentFixture<ContactDetailComponent>;
 | 
			
		||||
        const route = ({ data: of({ contact: new Contact(123) }) } as any) as ActivatedRoute;
 | 
			
		||||
    describe('SepaMandate Management Detail Component', () => {
 | 
			
		||||
        let comp: SepaMandateDetailComponent;
 | 
			
		||||
        let fixture: ComponentFixture<SepaMandateDetailComponent>;
 | 
			
		||||
        const route = ({ data: of({ sepaMandate: new SepaMandate(123) }) } as any) as ActivatedRoute;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [ContactDetailComponent],
 | 
			
		||||
                declarations: [SepaMandateDetailComponent],
 | 
			
		||||
                providers: [{ provide: ActivatedRoute, useValue: route }]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(ContactDetailComponent, '')
 | 
			
		||||
                .overrideTemplate(SepaMandateDetailComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
            fixture = TestBed.createComponent(ContactDetailComponent);
 | 
			
		||||
            fixture = TestBed.createComponent(SepaMandateDetailComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@@ -33,7 +33,7 @@ describe('Component Tests', () => {
 | 
			
		||||
                comp.ngOnInit();
 | 
			
		||||
 | 
			
		||||
                // THEN
 | 
			
		||||
                expect(comp.contact).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
                expect(comp.sepaMandate).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
@@ -4,35 +4,35 @@ import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { ContactUpdateComponent } from 'app/entities/contact/contact-update.component';
 | 
			
		||||
import { ContactService } from 'app/entities/contact/contact.service';
 | 
			
		||||
import { Contact } from 'app/shared/model/contact.model';
 | 
			
		||||
import { SepaMandateUpdateComponent } from 'app/entities/sepa-mandate/sepa-mandate-update.component';
 | 
			
		||||
import { SepaMandateService } from 'app/entities/sepa-mandate/sepa-mandate.service';
 | 
			
		||||
import { SepaMandate } from 'app/shared/model/sepa-mandate.model';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('Contact Management Update Component', () => {
 | 
			
		||||
        let comp: ContactUpdateComponent;
 | 
			
		||||
        let fixture: ComponentFixture<ContactUpdateComponent>;
 | 
			
		||||
        let service: ContactService;
 | 
			
		||||
    describe('SepaMandate Management Update Component', () => {
 | 
			
		||||
        let comp: SepaMandateUpdateComponent;
 | 
			
		||||
        let fixture: ComponentFixture<SepaMandateUpdateComponent>;
 | 
			
		||||
        let service: SepaMandateService;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [ContactUpdateComponent]
 | 
			
		||||
                declarations: [SepaMandateUpdateComponent]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(ContactUpdateComponent, '')
 | 
			
		||||
                .overrideTemplate(SepaMandateUpdateComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
 | 
			
		||||
            fixture = TestBed.createComponent(ContactUpdateComponent);
 | 
			
		||||
            fixture = TestBed.createComponent(SepaMandateUpdateComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
            service = fixture.debugElement.injector.get(ContactService);
 | 
			
		||||
            service = fixture.debugElement.injector.get(SepaMandateService);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('save', () => {
 | 
			
		||||
            it('Should call update service on save for existing entity', fakeAsync(() => {
 | 
			
		||||
                // GIVEN
 | 
			
		||||
                const entity = new Contact(123);
 | 
			
		||||
                const entity = new SepaMandate(123);
 | 
			
		||||
                spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
 | 
			
		||||
                comp.contact = entity;
 | 
			
		||||
                comp.sepaMandate = entity;
 | 
			
		||||
                // WHEN
 | 
			
		||||
                comp.save();
 | 
			
		||||
                tick(); // simulate async
 | 
			
		||||
@@ -44,9 +44,9 @@ describe('Component Tests', () => {
 | 
			
		||||
 | 
			
		||||
            it('Should call create service on save for new entity', fakeAsync(() => {
 | 
			
		||||
                // GIVEN
 | 
			
		||||
                const entity = new Contact();
 | 
			
		||||
                const entity = new SepaMandate();
 | 
			
		||||
                spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
 | 
			
		||||
                comp.contact = entity;
 | 
			
		||||
                comp.sepaMandate = entity;
 | 
			
		||||
                // WHEN
 | 
			
		||||
                comp.save();
 | 
			
		||||
                tick(); // simulate async
 | 
			
		||||
@@ -5,20 +5,20 @@ import { HttpHeaders, HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { ActivatedRoute, Data } from '@angular/router';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { ContactComponent } from 'app/entities/contact/contact.component';
 | 
			
		||||
import { ContactService } from 'app/entities/contact/contact.service';
 | 
			
		||||
import { Contact } from 'app/shared/model/contact.model';
 | 
			
		||||
import { SepaMandateComponent } from 'app/entities/sepa-mandate/sepa-mandate.component';
 | 
			
		||||
import { SepaMandateService } from 'app/entities/sepa-mandate/sepa-mandate.service';
 | 
			
		||||
import { SepaMandate } from 'app/shared/model/sepa-mandate.model';
 | 
			
		||||
 | 
			
		||||
describe('Component Tests', () => {
 | 
			
		||||
    describe('Contact Management Component', () => {
 | 
			
		||||
        let comp: ContactComponent;
 | 
			
		||||
        let fixture: ComponentFixture<ContactComponent>;
 | 
			
		||||
        let service: ContactService;
 | 
			
		||||
    describe('SepaMandate Management Component', () => {
 | 
			
		||||
        let comp: SepaMandateComponent;
 | 
			
		||||
        let fixture: ComponentFixture<SepaMandateComponent>;
 | 
			
		||||
        let service: SepaMandateService;
 | 
			
		||||
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HsadminNgTestModule],
 | 
			
		||||
                declarations: [ContactComponent],
 | 
			
		||||
                declarations: [SepaMandateComponent],
 | 
			
		||||
                providers: [
 | 
			
		||||
                    {
 | 
			
		||||
                        provide: ActivatedRoute,
 | 
			
		||||
@@ -37,12 +37,12 @@ describe('Component Tests', () => {
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            })
 | 
			
		||||
                .overrideTemplate(ContactComponent, '')
 | 
			
		||||
                .overrideTemplate(SepaMandateComponent, '')
 | 
			
		||||
                .compileComponents();
 | 
			
		||||
 | 
			
		||||
            fixture = TestBed.createComponent(ContactComponent);
 | 
			
		||||
            fixture = TestBed.createComponent(SepaMandateComponent);
 | 
			
		||||
            comp = fixture.componentInstance;
 | 
			
		||||
            service = fixture.debugElement.injector.get(ContactService);
 | 
			
		||||
            service = fixture.debugElement.injector.get(SepaMandateService);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('Should call load all on init', () => {
 | 
			
		||||
@@ -51,7 +51,7 @@ describe('Component Tests', () => {
 | 
			
		||||
            spyOn(service, 'query').and.returnValue(
 | 
			
		||||
                of(
 | 
			
		||||
                    new HttpResponse({
 | 
			
		||||
                        body: [new Contact(123)],
 | 
			
		||||
                        body: [new SepaMandate(123)],
 | 
			
		||||
                        headers
 | 
			
		||||
                    })
 | 
			
		||||
                )
 | 
			
		||||
@@ -62,7 +62,7 @@ describe('Component Tests', () => {
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(service.query).toHaveBeenCalled();
 | 
			
		||||
            expect(comp.contacts[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
            expect(comp.sepaMandates[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should load a page', () => {
 | 
			
		||||
@@ -71,7 +71,7 @@ describe('Component Tests', () => {
 | 
			
		||||
            spyOn(service, 'query').and.returnValue(
 | 
			
		||||
                of(
 | 
			
		||||
                    new HttpResponse({
 | 
			
		||||
                        body: [new Contact(123)],
 | 
			
		||||
                        body: [new SepaMandate(123)],
 | 
			
		||||
                        headers
 | 
			
		||||
                    })
 | 
			
		||||
                )
 | 
			
		||||
@@ -82,7 +82,7 @@ describe('Component Tests', () => {
 | 
			
		||||
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(service.query).toHaveBeenCalled();
 | 
			
		||||
            expect(comp.contacts[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
            expect(comp.sepaMandates[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it('should re-initialize the page', () => {
 | 
			
		||||
@@ -91,7 +91,7 @@ describe('Component Tests', () => {
 | 
			
		||||
            spyOn(service, 'query').and.returnValue(
 | 
			
		||||
                of(
 | 
			
		||||
                    new HttpResponse({
 | 
			
		||||
                        body: [new Contact(123)],
 | 
			
		||||
                        body: [new SepaMandate(123)],
 | 
			
		||||
                        headers
 | 
			
		||||
                    })
 | 
			
		||||
                )
 | 
			
		||||
@@ -104,7 +104,7 @@ describe('Component Tests', () => {
 | 
			
		||||
            // THEN
 | 
			
		||||
            expect(comp.page).toEqual(0);
 | 
			
		||||
            expect(service.query).toHaveBeenCalledTimes(2);
 | 
			
		||||
            expect(comp.contacts[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
            expect(comp.sepaMandates[0]).toEqual(jasmine.objectContaining({ id: 123 }));
 | 
			
		||||
        });
 | 
			
		||||
        it('should calculate the sort attribute for an id', () => {
 | 
			
		||||
            // WHEN
 | 
			
		||||
@@ -0,0 +1,176 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { TestBed, getTestBed } 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 * as moment from 'moment';
 | 
			
		||||
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
 | 
			
		||||
import { SepaMandateService } from 'app/entities/sepa-mandate/sepa-mandate.service';
 | 
			
		||||
import { ISepaMandate, SepaMandate } from 'app/shared/model/sepa-mandate.model';
 | 
			
		||||
 | 
			
		||||
describe('Service Tests', () => {
 | 
			
		||||
    describe('SepaMandate Service', () => {
 | 
			
		||||
        let injector: TestBed;
 | 
			
		||||
        let service: SepaMandateService;
 | 
			
		||||
        let httpMock: HttpTestingController;
 | 
			
		||||
        let elemDefault: ISepaMandate;
 | 
			
		||||
        let currentDate: moment.Moment;
 | 
			
		||||
        beforeEach(() => {
 | 
			
		||||
            TestBed.configureTestingModule({
 | 
			
		||||
                imports: [HttpClientTestingModule]
 | 
			
		||||
            });
 | 
			
		||||
            injector = getTestBed();
 | 
			
		||||
            service = injector.get(SepaMandateService);
 | 
			
		||||
            httpMock = injector.get(HttpTestingController);
 | 
			
		||||
            currentDate = moment();
 | 
			
		||||
 | 
			
		||||
            elemDefault = new SepaMandate(
 | 
			
		||||
                0,
 | 
			
		||||
                'AAAAAAA',
 | 
			
		||||
                'AAAAAAA',
 | 
			
		||||
                'AAAAAAA',
 | 
			
		||||
                currentDate,
 | 
			
		||||
                currentDate,
 | 
			
		||||
                currentDate,
 | 
			
		||||
                currentDate,
 | 
			
		||||
                currentDate,
 | 
			
		||||
                'AAAAAAA'
 | 
			
		||||
            );
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        describe('Service methods', async () => {
 | 
			
		||||
            it('should find an element', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        created: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validFrom: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validTo: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        lastUsed: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        cancelled: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                service
 | 
			
		||||
                    .find(123)
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: elemDefault }));
 | 
			
		||||
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'GET' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should create a SepaMandate', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        id: 0,
 | 
			
		||||
                        created: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validFrom: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validTo: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        lastUsed: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        cancelled: currentDate.format(DATE_FORMAT)
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        created: currentDate,
 | 
			
		||||
                        validFrom: currentDate,
 | 
			
		||||
                        validTo: currentDate,
 | 
			
		||||
                        lastUsed: currentDate,
 | 
			
		||||
                        cancelled: currentDate
 | 
			
		||||
                    },
 | 
			
		||||
                    returnedFromService
 | 
			
		||||
                );
 | 
			
		||||
                service
 | 
			
		||||
                    .create(new SepaMandate(null))
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: expected }));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'POST' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should update a SepaMandate', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        reference: 'BBBBBB',
 | 
			
		||||
                        iban: 'BBBBBB',
 | 
			
		||||
                        bic: 'BBBBBB',
 | 
			
		||||
                        created: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validFrom: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validTo: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        lastUsed: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        cancelled: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        comment: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                const expected = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        created: currentDate,
 | 
			
		||||
                        validFrom: currentDate,
 | 
			
		||||
                        validTo: currentDate,
 | 
			
		||||
                        lastUsed: currentDate,
 | 
			
		||||
                        cancelled: currentDate
 | 
			
		||||
                    },
 | 
			
		||||
                    returnedFromService
 | 
			
		||||
                );
 | 
			
		||||
                service
 | 
			
		||||
                    .update(expected)
 | 
			
		||||
                    .pipe(take(1))
 | 
			
		||||
                    .subscribe(resp => expect(resp).toMatchObject({ body: expected }));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'PUT' });
 | 
			
		||||
                req.flush(JSON.stringify(returnedFromService));
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should return a list of SepaMandate', async () => {
 | 
			
		||||
                const returnedFromService = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        reference: 'BBBBBB',
 | 
			
		||||
                        iban: 'BBBBBB',
 | 
			
		||||
                        bic: 'BBBBBB',
 | 
			
		||||
                        created: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validFrom: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        validTo: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        lastUsed: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        cancelled: currentDate.format(DATE_FORMAT),
 | 
			
		||||
                        comment: 'BBBBBB'
 | 
			
		||||
                    },
 | 
			
		||||
                    elemDefault
 | 
			
		||||
                );
 | 
			
		||||
                const expected = Object.assign(
 | 
			
		||||
                    {
 | 
			
		||||
                        created: currentDate,
 | 
			
		||||
                        validFrom: currentDate,
 | 
			
		||||
                        validTo: currentDate,
 | 
			
		||||
                        lastUsed: currentDate,
 | 
			
		||||
                        cancelled: currentDate
 | 
			
		||||
                    },
 | 
			
		||||
                    returnedFromService
 | 
			
		||||
                );
 | 
			
		||||
                service
 | 
			
		||||
                    .query(expected)
 | 
			
		||||
                    .pipe(
 | 
			
		||||
                        take(1),
 | 
			
		||||
                        map(resp => resp.body)
 | 
			
		||||
                    )
 | 
			
		||||
                    .subscribe(body => expect(body).toContainEqual(expected));
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'GET' });
 | 
			
		||||
                req.flush(JSON.stringify([returnedFromService]));
 | 
			
		||||
                httpMock.verify();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it('should delete a SepaMandate', async () => {
 | 
			
		||||
                const rxPromise = service.delete(123).subscribe(resp => expect(resp.ok));
 | 
			
		||||
 | 
			
		||||
                const req = httpMock.expectOne({ method: 'DELETE' });
 | 
			
		||||
                req.flush({ status: 200 });
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        afterEach(() => {
 | 
			
		||||
            httpMock.verify();
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/* tslint:disable max-line-length */
 | 
			
		||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
 | 
			
		||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
 | 
			
		||||
import { HttpResponse } from '@angular/common/http';
 | 
			
		||||
import { of } from 'rxjs';
 | 
			
		||||
import { Observable, of } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
import { HsadminNgTestModule } from '../../../test.module';
 | 
			
		||||
import { ShareUpdateComponent } from 'app/entities/share/share-update.component';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user