Skip to content

Commit

Permalink
dependencies updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4mpy committed May 21, 2024
1 parent 2506697 commit bdc0fbe
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.4</version>
<version>3.2.5</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

Expand All @@ -16,14 +16,14 @@
<packaging>pom</packaging>

<properties>
<java.version>21</java.version>
<java.version>22</java.version>
<spring-cloud-dependencies.version>2023.0.1</spring-cloud-dependencies.version>
<com.c4-soft.springaddons.version>7.6.11</com.c4-soft.springaddons.version>
<com.c4-soft.springaddons.version>7.7.0</com.c4-soft.springaddons.version>
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
<org.mapstruct.version>1.6.0.Beta1</org.mapstruct.version>
<openapi-generator-maven-plugin.version>7.2.0</openapi-generator-maven-plugin.version>
<swagger-annotations.version>2.2.20</swagger-annotations.version>
<springdoc-openapi.version>2.3.0</springdoc-openapi.version>
<openapi-generator-maven-plugin.version>7.6.0</openapi-generator-maven-plugin.version>
<swagger-annotations.version>2.2.22</swagger-annotations.version>
<springdoc-openapi.version>2.5.0</springdoc-openapi.version>
<springdoc-openapi-maven-plugin.version>1.4</springdoc-openapi-maven-plugin.version>
<integration-tests.scheme>http</integration-tests.scheme>
<integration-tests.hostname>localhost</integration-tests.hostname>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.c4soft.quiz.web;

import static org.hamcrest.CoreMatchers.is;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;

import com.c4_soft.springaddons.security.oauth2.test.annotations.WithJwt;
import com.c4_soft.springaddons.security.oauth2.test.webmvc.AutoConfigureAddonsWebmvcResourceServerSecurity;
import com.c4_soft.springaddons.security.oauth2.test.webmvc.MockMvcSupport;
import com.c4soft.quiz.EnableSpringDataWebSupportTestConf;
import com.c4soft.quiz.SecurityConfig;
import com.c4soft.quiz.web.dto.QuizUpdateDto;

@WebMvcTest(controllers = QuizController.class)
@ActiveProfiles("h2")
@Import({ EnableSpringDataWebSupportTestConf.class, ExceptionHandlers.class, SecurityConfig.class })
@AutoConfigureAddonsWebmvcResourceServerSecurity
class QuizControllerTest {
@Autowired
MockMvcSupport api;

@Test
@WithJwt("ch4mp.json")
void givenUserIsCh4mp_whenPayloadIsInvalid_then422WithValidationExceptionsInProblemDetails() throws Exception {
api
.post(new QuizUpdateDto("", null, null, null, null), "/quizzes")
.andExpect(status().isUnprocessableEntity())
.andExpect(jsonPath("$.invalidFields.title", is("NotEmpty")))
.andExpect(jsonPath("$.invalidFields.isChoicesShuffled", is("NotNull")))
.andExpect(jsonPath("$.invalidFields.isReplayEnabled", is("NotNull")))
.andExpect(jsonPath("$.invalidFields.isPerQuestionResult", is("NotNull")))
.andExpect(jsonPath("$.invalidFields.isTrainerNotifiedOfNewTests", is("NotNull")));
}
}

0 comments on commit bdc0fbe

Please sign in to comment.