// Path: booking-service/src/main/java/de/codecentric/resilient/booking/service/BookingService.java
// @Service
// public class BookingService {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(BookingService.class);
// 
//     private final BookingRepository bookingRepository;
// 
//     private final BookingMapper bookingMapper;
// 
//     private final RestTemplate restTemplate;
// 
//     private DynamicBooleanProperty secondServiceCallEnabled =
//         DynamicPropertyFactory.getInstance().getBooleanProperty("second.service.call", false);
// 
//     @Autowired
//     public BookingService(BookingRepository bookingRepository, BookingMapper bookingMapper, RestTemplate restTemplate) {
//         this.bookingRepository = bookingRepository;
//         this.bookingMapper = bookingMapper;
//         this.restTemplate = restTemplate;
//     }
// 
//     public BookingServiceResponseDTO createBooking(BookingServiceRequestDTO bookingRequestDTO) {
// 
//         BookingServiceResponseDTO bookingResponseDTO = new BookingServiceResponseDTO();
// 
//         // 1.) Create connote
//         ConnoteDTO connoteDTO = receiveConnote();
// 
//         if (connoteDTO.isFallback()) {
//             bookingResponseDTO.setErrorMsg("Connote error: " + connoteDTO.getErrorMsg());
//             bookingResponseDTO.setStatus("ERROR");
//             return bookingResponseDTO;
//         }
// 
//         // 2. Save booking request
// 
//         Booking booking = bookingMapper.mapToBookingEntity(bookingRequestDTO, connoteDTO.getConnote());
//         bookingRepository.save(booking);
// 
//         CustomerResponseDTO customerDTO = bookingRequestDTO.getCustomerDTO();
//         bookingResponseDTO.setCustomerDTO(new CustomerDTO(customerDTO.getCustomerId(), customerDTO.getCustomerName()));
//         bookingResponseDTO.setConnoteDTO(connoteDTO);
//         bookingResponseDTO.setStatus("OK");
// 
//         return bookingResponseDTO;
// 
//     }
// 
//     private ConnoteDTO receiveConnote() {
//         LOGGER.debug("Starting getConnote");
// 
//         return new ConnoteCommand(restTemplate, secondServiceCallEnabled.get()).execute();
//     }
// }


import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import de.codecentric.resilient.booking.service.BookingService;
import de.codecentric.resilient.dto.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
package de.codecentric.resilient.booking.rest;



/**
 * @author Benjamin Wilms (xd98870)
 */
@RunWith(MockitoJUnitRunner.class)
public class BookingControllerTest {
    @Test
    public void create1() throws Exception {

    }

    private MockMvc mockMvc;

    @Mock
// Path: booking-service/src/main/java/de/codecentric/resilient/booking/service/BookingService.java
// @Service
// public class BookingService {
// 
//     private static final Logger LOGGER = LoggerFactory.getLogger(BookingService.class);
// 
//     private final BookingRepository bookingRepository;
// 
//     private final BookingMapper bookingMapper;
// 
//     private final RestTemplate restTemplate;
// 
//     private DynamicBooleanProperty secondServiceCallEnabled =
//         DynamicPropertyFactory.getInstance().getBooleanProperty("second.service.call", false);
// 
//     @Autowired
//     public BookingService(BookingRepository bookingRepository, BookingMapper bookingMapper, RestTemplate restTemplate) {
//         this.bookingRepository = bookingRepository;
//         this.bookingMapper = bookingMapper;
//         this.restTemplate = restTemplate;
//     }
// 
//     public BookingServiceResponseDTO createBooking(BookingServiceRequestDTO bookingRequestDTO) {
// 
//         BookingServiceResponseDTO bookingResponseDTO = new BookingServiceResponseDTO();
// 
//         // 1.) Create connote
//         ConnoteDTO connoteDTO = receiveConnote();
// 
//         if (connoteDTO.isFallback()) {
//             bookingResponseDTO.setErrorMsg("Connote error: " + connoteDTO.getErrorMsg());
//             bookingResponseDTO.setStatus("ERROR");
//             return bookingResponseDTO;
//         }
// 
//         // 2. Save booking request
// 
//         Booking booking = bookingMapper.mapToBookingEntity(bookingRequestDTO, connoteDTO.getConnote());
//         bookingRepository.save(booking);
// 
//         CustomerResponseDTO customerDTO = bookingRequestDTO.getCustomerDTO();
//         bookingResponseDTO.setCustomerDTO(new CustomerDTO(customerDTO.getCustomerId(), customerDTO.getCustomerName()));
//         bookingResponseDTO.setConnoteDTO(connoteDTO);
//         bookingResponseDTO.setStatus("OK");
// 
//         return bookingResponseDTO;
// 
//     }
// 
//     private ConnoteDTO receiveConnote() {
//         LOGGER.debug("Starting getConnote");
// 
//         return new ConnoteCommand(restTemplate, secondServiceCallEnabled.get()).execute();
//     }
// }


// Path: booking-service/src/test/java/de/codecentric/resilient/booking/rest/BookingControllerTest.java
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import de.codecentric.resilient.booking.service.BookingService;
import de.codecentric.resilient.dto.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

package de.codecentric.resilient.booking.rest;



/**
 * @author Benjamin Wilms (xd98870)
 */
@RunWith(MockitoJUnitRunner.class)
public class BookingControllerTest {
    @Test
    public void create1() throws Exception {

    }

    private MockMvc mockMvc;

    @Mock
    private BookingService bookingServiceMock;