This file contains 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 characters
package com.its.reservation; | |
import org.assertj.core.api.Assertions; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |
import org.springframework.boot.test.web.client.TestRestTemplate; | |
import org.springframework.http.HttpStatus; |
This file contains 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 characters
package com.its.reservation.web; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestMethod; | |
import org.springframework.web.bind.annotation.RestController; | |
import com.its.reservation.repository.Reservation; | |
/** |
This file contains 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 characters
@RestController | |
@RequestMapping("/reservation") | |
public class ReservationController { | |
private ReservationService reservationService; | |
public ReservationController(ReservationService reservationService) { | |
this.reservationService = reservationService; | |
} |
This file contains 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 characters
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; | |
import org.springframework.test.context.junit4.SpringRunner; | |
import org.springframework.test.web.servlet.MockMvc; | |
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | |
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; | |
import com.its.reservation.web.ReservationController; |
This file contains 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 characters
@RunWith(SpringRunner.class) | |
@WebMvcTest(ReservationController.class) | |
public class ReservationControllerTest { | |
@Autowired | |
private MockMvc mockMvc; | |
@MockBean | |
ReservationService reservationService; | |
@Test |
This file contains 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 characters
@RunWith(SpringRunner.class) | |
@WebMvcTest(ReservationController.class) | |
public class ReservationControllerTest { | |
@Autowired | |
private MockMvc mockMvc; | |
@MockBean | |
ReservationService reservationService; | |
@Test |
This file contains 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 characters
@RestController | |
@RequestMapping("/reservation") | |
public class ReservationController { | |
private ReservationService reservationService; | |
public ReservationController(ReservationService reservationService) { | |
this.reservationService = reservationService; | |
} | |
@RequestMapping(method = RequestMethod.GET, value = "/{name}") |
This file contains 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 characters
package com.its.reservation; | |
import static org.assertj.core.api.Assertions.assertThat; | |
import org.junit.Test; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import com.its.reservation.repository.Reservation; | |
import com.its.reservation.service.ReservationService; |
This file contains 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 characters
package com.its.reservation.repository; | |
import org.springframework.data.repository.CrudRepository; | |
public interface ReservationRepository extends CrudRepository<Reservation, Long> { | |
Reservation findByFirstName(String name); | |
} |
This file contains 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 characters
package com.its.reservation.service; | |
import org.springframework.stereotype.Service; | |
import com.its.reservation.repository.Reservation; | |
@Service | |
public class ReservationService { | |
public Reservation getReservationDetails(String name) { | |
return null; |
OlderNewer