using IntTests.createEntity() as generated by JHipster with required fields
This commit is contained in:
		@@ -106,10 +106,8 @@ public class AssetResourceIntTest {
 | 
			
		||||
     * This is a static method, as tests for other entities might also need it,
 | 
			
		||||
     * if they test an entity which requires the current entity.
 | 
			
		||||
     */
 | 
			
		||||
    public static Asset createEntity(EntityManager em, Membership membership) {
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
    public static Asset createEntity(EntityManager em) {
 | 
			
		||||
        Asset asset = new Asset()
 | 
			
		||||
            .member(membership)
 | 
			
		||||
            .date(DEFAULT_DATE)
 | 
			
		||||
            .action(DEFAULT_ACTION)
 | 
			
		||||
            .amount(DEFAULT_AMOUNT)
 | 
			
		||||
@@ -124,7 +122,7 @@ public class AssetResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        asset = createEntity(em, MembershipResourceIntTest.createEntity(em, CustomerResourceIntTest.createEntity(em)));
 | 
			
		||||
        asset = createEntity(em);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -447,7 +445,7 @@ public class AssetResourceIntTest {
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllAssetsByMemberIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Membership member = MembershipResourceIntTest.createEntity(em, CustomerResourceIntTest.createAnotherEntity(em));
 | 
			
		||||
        Membership member = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(member);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        asset.setMember(member);
 | 
			
		||||
 
 | 
			
		||||
@@ -44,20 +44,20 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 | 
			
		||||
public class CustomerResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    private static final Integer DEFAULT_NUMBER = 10000;
 | 
			
		||||
    private static final Integer ANOTHER_NUMBER = 10001;
 | 
			
		||||
    private static final Integer UPDATED_NUMBER = 10002;
 | 
			
		||||
    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 ANOTHER_PREFIX = "old";
 | 
			
		||||
    private static final String UPDATED_PREFIX = "new";
 | 
			
		||||
    private static final String OTHER_PREFIX_BASE = "o";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_NAME = "Default GmbH";
 | 
			
		||||
    private static final String UPDATED_NAME = "Updated Default GmbH";
 | 
			
		||||
    private static final String ANOTHER_NAME = "Another Corp.";
 | 
			
		||||
    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 ANOTHER_CONTRACTUAL_ADDRESS = "Another Address";
 | 
			
		||||
    private static final String OTHER_CONTRACTUAL_ADDRESS_BASE = "Other Street ";
 | 
			
		||||
 | 
			
		||||
    private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
 | 
			
		||||
@@ -68,6 +68,8 @@ public class CustomerResourceIntTest {
 | 
			
		||||
    private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
 | 
			
		||||
    private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
 | 
			
		||||
 | 
			
		||||
    private static int otherCounter = 0;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private CustomerRepository customerRepository;
 | 
			
		||||
 | 
			
		||||
@@ -137,10 +139,11 @@ public class CustomerResourceIntTest {
 | 
			
		||||
     */
 | 
			
		||||
    public static Customer createAnotherEntity(EntityManager em) {
 | 
			
		||||
        Customer customer = new Customer()
 | 
			
		||||
            .number(ANOTHER_NUMBER)
 | 
			
		||||
            .prefix(ANOTHER_PREFIX)
 | 
			
		||||
            .name(ANOTHER_NAME)
 | 
			
		||||
            .contractualAddress(ANOTHER_CONTRACTUAL_ADDRESS);
 | 
			
		||||
            .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;
 | 
			
		||||
        return customer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -614,7 +617,7 @@ public class CustomerResourceIntTest {
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Membership membership = MembershipResourceIntTest.createEntity(em, customer);
 | 
			
		||||
        Membership membership = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        customer.addMembership(membership);
 | 
			
		||||
 
 | 
			
		||||
@@ -102,14 +102,12 @@ 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, final Customer customer) {
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
    public static Membership createEntity(final EntityManager em) {
 | 
			
		||||
        Membership membership = new Membership()
 | 
			
		||||
            .customer(customer)
 | 
			
		||||
            .sinceDate(DEFAULT_SINCE_DATE)
 | 
			
		||||
            .untilDate(DEFAULT_UNTIL_DATE);
 | 
			
		||||
        // Add required entity
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createEntity(em);
 | 
			
		||||
        Customer customer = CustomerResourceIntTest.createAnotherEntity(em);
 | 
			
		||||
        em.persist(customer);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        membership.setCustomer(customer);
 | 
			
		||||
@@ -118,7 +116,7 @@ public class MembershipResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        membership = createEntity(em, CustomerResourceIntTest.createEntity(em));
 | 
			
		||||
        membership = createEntity(em);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -365,11 +363,11 @@ public class MembershipResourceIntTest {
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllMembershipsByAssetIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Asset asset = AssetResourceIntTest.createEntity(em, membership);
 | 
			
		||||
        Asset asset = AssetResourceIntTest.createEntity(em);
 | 
			
		||||
        membership.addAsset(asset);
 | 
			
		||||
        em.persist(membership);
 | 
			
		||||
        em.persist(asset);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        membership.addAsset(asset);
 | 
			
		||||
        membershipRepository.flush();
 | 
			
		||||
        Long assetId = asset.getId();
 | 
			
		||||
 | 
			
		||||
        // Get all the membershipList where asset equals to assetId
 | 
			
		||||
 
 | 
			
		||||
@@ -119,7 +119,7 @@ public class ShareResourceIntTest {
 | 
			
		||||
 | 
			
		||||
    @Before
 | 
			
		||||
    public void initTest() {
 | 
			
		||||
        share = createEntity(em, MembershipResourceIntTest.createEntity(em, CustomerResourceIntTest.createEntity(em)));
 | 
			
		||||
        share = createEntity(em, MembershipResourceIntTest.createEntity(em));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -470,7 +470,7 @@ public class ShareResourceIntTest {
 | 
			
		||||
    @Transactional
 | 
			
		||||
    public void getAllSharesByMemberIsEqualToSomething() throws Exception {
 | 
			
		||||
        // Initialize the database
 | 
			
		||||
        Membership member = MembershipResourceIntTest.createEntity(em, CustomerResourceIntTest.createAnotherEntity(em));
 | 
			
		||||
        Membership member = MembershipResourceIntTest.createEntity(em);
 | 
			
		||||
        em.persist(member);
 | 
			
		||||
        em.flush();
 | 
			
		||||
        share.setMember(member);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user