Skip to content

Instantly share code, notes, and snippets.

@calvinclaus
Created April 22, 2017 13:15
Show Gist options
  • Select an option

  • Save calvinclaus/1385f89362072586f204e821b982d0a1 to your computer and use it in GitHub Desktop.

Select an option

Save calvinclaus/1385f89362072586f204e821b982d0a1 to your computer and use it in GitHub Desktop.

Revisions

  1. calvinclaus created this gist Apr 22, 2017.
    37 changes: 37 additions & 0 deletions adsfas.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    package at.ac.tuwien.inso.sepm.ticketline.server.unittest.customer;

    import at.ac.tuwien.inso.sepm.ticketline.server.entity.Customer;
    import at.ac.tuwien.inso.sepm.ticketline.server.service.CustomerService;
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.boot.test.context.SpringBootTest;
    import org.springframework.test.context.junit4.SpringRunner;

    import static org.junit.Assert.*;

    import java.util.List;


    @RunWith(SpringRunner.class)
    @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
    public class CustomerUnitTest {
    private final static Logger LOGGER = LoggerFactory.getLogger(CustomerUnitTest.class);


    @Autowired
    private CustomerService customerService;

    private static final String CUSTOMER_NAME = "Maximilian Muster";

    @Test
    public void createValidCustomer() {
    Customer cust = new Customer();
    cust.setName(CUSTOMER_NAME);
    customerService.save(cust);
    List<Customer> list = customerService.findAll();
    assertTrue(list.contains(cust));
    }
    }