Created
April 22, 2017 13:15
-
-
Save calvinclaus/1385f89362072586f204e821b982d0a1 to your computer and use it in GitHub Desktop.
Revisions
-
calvinclaus created this gist
Apr 22, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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)); } }