API 1.0.16 CustomerExerciseDeviceTest
This commit is contained in:
parent
75a1d57302
commit
d37629ff72
@ -21,14 +21,14 @@ class CustomerExerciseDeviceTest {
|
||||
private lateinit var customerExerciseDeviceRepository: CustomerExerciseDeviceRepository
|
||||
|
||||
@Test
|
||||
fun testGetPurchaseByCustomerId() {
|
||||
fun testGetDevicesByCustomerId() {
|
||||
val controller = CustomerExerciseDeviceController(customerExerciseDeviceRepository)
|
||||
val response = controller.getAllByCustomerId(90)
|
||||
|
||||
val devices = response.body
|
||||
|
||||
assertTrue(devices is List)
|
||||
assertTrue(devices.isNotEmpty())
|
||||
assertTrue(devices!!.isNotEmpty())
|
||||
assertEquals(devices.size, 2)
|
||||
assertEquals(devices[0].exerciseDeviceId, 1)
|
||||
assertEquals(devices[0].customerId, 90)
|
||||
@ -58,7 +58,7 @@ class CustomerExerciseDeviceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun deleteDevice() {
|
||||
fun testDeleteDevice() {
|
||||
val customerExerciseDevice = CustomerExerciseDevice(
|
||||
exerciseDeviceId = 3,
|
||||
favourite = false,
|
||||
@ -73,7 +73,31 @@ class CustomerExerciseDeviceTest {
|
||||
val device = response.body
|
||||
assertTrue(device != null)
|
||||
|
||||
val responseDelete = controller.deleteCustomerExerciseDevice(device)
|
||||
val responseDelete = controller.deleteCustomerExerciseDevice(device.customerExerciseDeviceId)
|
||||
assertEquals(responseDelete.statusCode, HttpStatus.OK)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFindById() {
|
||||
val device = customerExerciseDeviceRepository.findById(1).orElse(null);
|
||||
assertTrue(device != null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
fun testJustDeleteDevice() {
|
||||
val device = CustomerExerciseDevice(
|
||||
customerExerciseDeviceId = 3,
|
||||
exerciseDeviceId = 5,
|
||||
favourite = false,
|
||||
dateAdd = "2020-11-23 04:32:00",
|
||||
customerId = 90
|
||||
)
|
||||
|
||||
val controller = CustomerExerciseDeviceController(customerExerciseDeviceRepository)
|
||||
|
||||
val responseDelete = controller.deleteCustomerExerciseDevice(device.customerExerciseDeviceId)
|
||||
assertEquals(responseDelete.statusCode, HttpStatus.OK)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user