Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.tdevilleduc.urthehero.back.exceptions.EnemyInternalErrorException
import com.tdevilleduc.urthehero.back.model.Enemy
import com.tdevilleduc.urthehero.back.model.EnemyDTO
import com.tdevilleduc.urthehero.back.service.IEnemyService
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.security.SecurityRequirement
import io.swagger.v3.oas.annotations.tags.Tag
import org.slf4j.helpers.MessageFormatter
Expand All @@ -24,20 +23,17 @@ internal class EnemyController(private val enemyService: IEnemyService) {

@GetMapping(value = ["/{enemyId}"], produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseStatus(HttpStatus.OK)
// @Operation(summary = "\${swagger.controller.enemy.get-by-id.value}", description = "\${swagger.controller.enemy.get-by-id.notes}")
fun getById(@PathVariable enemyId: Int): Callable<ResponseEntity<Enemy>> = Callable {
ResponseEntity.ok(enemyService.findById(enemyId))
}

@GetMapping(value = ["/level/{enemyLevel}"], produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseStatus(HttpStatus.OK)
// @Operation(summary = "\${swagger.controller.enemy.get-by-level.value}", description = "\${swagger.controller.enemy.get-by-level.notes}")
fun getByLevel(@PathVariable enemyLevel: Int): Callable<ResponseEntity<Enemy>> = Callable {
ResponseEntity.ok(enemyService.findByLevel(enemyLevel))
}

@PutMapping
// @Operation(summary = "\${swagger.controller.enemy.create.value}", description = "\${swagger.controller.enemy.create.notes}")
fun create(@RequestBody enemyDto: EnemyDTO): Callable<ResponseEntity<EnemyDTO>> = Callable {
if (enemyService.exists(enemyDto.id)) {
throw EnemyInternalErrorException(MessageFormatter.format(ApplicationConstants.ERROR_MESSAGE_ENEMY_ID_ALREADY_EXISTS, enemyDto.id).message)
Expand All @@ -46,7 +42,6 @@ internal class EnemyController(private val enemyService: IEnemyService) {
}

@PostMapping
// @Operation(summary = "\${swagger.controller.enemy.update.value}", description = "\${swagger.controller.enemy.update.notes}")
fun update(@RequestBody enemyDto: EnemyDTO): Callable<ResponseEntity<EnemyDTO>> = Callable {
Assert.notNull(enemyDto.id) { throw EnemyInternalErrorException(ApplicationConstants.ERROR_MESSAGE_ENEMY_ID_CANNOT_BE_NULL) }
if (enemyService.notExists(enemyDto.id)) {
Expand All @@ -56,7 +51,6 @@ internal class EnemyController(private val enemyService: IEnemyService) {
}

@DeleteMapping(value = ["/{enemyId}"])
// @Operation(summary = "\${swagger.controller.enemy.delete.value}", description = "\${swagger.controller.enemy.delete.notes}")
fun delete(@PathVariable enemyId: Int) = Callable {
enemyService.delete(enemyId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ class ProgressionControllerTest : AbstractITTest() {
.andExpect(MockMvcResultMatchers.jsonPath("$[0].userId", Matchers.`is`(userId)))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].storyId", Matchers.`is`(2)))
.andExpect(MockMvcResultMatchers.jsonPath("$[0].actualPageId", Matchers.`is`(3)))
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].userId", Matchers.`is`(userId)))
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].storyId", Matchers.`is`(1)))
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].actualPageId", Matchers.`is`(2)))
}

@Test
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,6 @@ internal class PageServiceTest {
Assertions.assertEquals(expectedPage.id, page.id)
Assertions.assertEquals(expectedPage.image, page.image)
Assertions.assertEquals(expectedPage.text, page.text)
// val nextPageList = page.nextPageList
// Assertions.assertNotNull(nextPageList)
// Assertions.assertFalse(nextPageList.isEmpty())
// Assertions.assertEquals(3, nextPageList.size)
// val nextPage1 = nextPageList[0]
// Assertions.assertNotNull(nextPage1)
// Assertions.assertEquals(1, nextPage1.id)
// Assertions.assertEquals(2, nextPage1.destinationPageId)
// Assertions.assertEquals(1, nextPage1.pageId)
// Assertions.assertEquals("gauche", nextPage1.text)
// Assertions.assertEquals(Position.LEFT, nextPage1.position)
// val nextPage2 = nextPageList[1]
// Assertions.assertNotNull(nextPage2)
// Assertions.assertEquals(2, nextPage2.id)
// Assertions.assertEquals(3, nextPage2.destinationPageId)
// Assertions.assertEquals(1, nextPage2.pageId)
// Assertions.assertEquals("droite", nextPage2.text)
// Assertions.assertEquals(Position.RIGHT, nextPage2.position)
// val nextPage3 = nextPageList[2]
// Assertions.assertNotNull(nextPage3)
// Assertions.assertEquals(3, nextPage3.id)
// Assertions.assertEquals(8, nextPage3.destinationPageId)
// Assertions.assertEquals(1, nextPage3.pageId)
// Assertions.assertEquals("centre", nextPage3.text)
// Assertions.assertEquals(Position.CENTER, nextPage3.position)
}

@Test
Expand Down