diff --git a/README.md b/README.md index 34bd5f29..a2e006ef 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![build](https://github.com/JKatzwinkel/tla-web/workflows/build/badge.svg) ![deploy](https://github.com/JKatzwinkel/tla-web/workflows/deploy/badge.svg) -![LINE](https://img.shields.io/badge/line--coverage-91.16%25-brightgreen.svg) -![METHOD](https://img.shields.io/badge/method--coverage-92.40%25-brightgreen.svg) +![LINE](https://img.shields.io/badge/line--coverage-91.37%25-brightgreen.svg) +![METHOD](https://img.shields.io/badge/method--coverage-94.04%25-brightgreen.svg) TLA web frontend. diff --git a/build.gradle b/build.gradle index 65bcb671..6f23e90a 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { id 'maven-publish' id 'de.undercouch.download' version '5.6.0' id 'com.adarshr.test-logger' version '4.0.0' - id 'org.springframework.boot' version '3.3.1' + id 'org.springframework.boot' version '3.4.0-M1' id 'com.github.ben-manes.versions' version '0.51.0' id 'com.github.dawnwords.jacoco.badge' version '0.2.4' } @@ -70,13 +70,13 @@ dependencies { implementation 'org.modelmapper:modelmapper:3.2.0' implementation 'org.jooq:jool:0.9.15' - implementation('org.springframework.boot:spring-boot-starter-jetty:3.3.1') { + implementation('org.springframework.boot:spring-boot-starter-jetty:3.4.0-M1') { exclude module: 'jetty-xml' } - implementation('org.springframework.boot:spring-boot-starter-web:3.3.1') { + implementation('org.springframework.boot:spring-boot-starter-web:3.4.0-M1') { exclude module: 'spring-boot-starter-tomcat' } - implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.3.1' + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.4.0-M1' implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0' implementation 'org.apache.commons:commons-lang3:3.14.0' @@ -87,7 +87,7 @@ dependencies { exclude group: 'bouncycastle' } - testImplementation 'org.springframework.boot:spring-boot-starter-test:3.3.1' + testImplementation 'org.springframework.boot:spring-boot-starter-test:3.4.0-M1' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0-M2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.0-M2' } diff --git a/src/main/java/tla/web/mvc/GlobalControllerAdvisor.java b/src/main/java/tla/web/mvc/GlobalControllerAdvisor.java index 4f6ad7a9..43347b41 100644 --- a/src/main/java/tla/web/mvc/GlobalControllerAdvisor.java +++ b/src/main/java/tla/web/mvc/GlobalControllerAdvisor.java @@ -80,4 +80,4 @@ public ModelAndView handleAnything(Exception e, HttpServletRequest request, Mode return new ModelAndView("error/404", model.asMap(), HttpStatus.OK); } -} \ No newline at end of file +} diff --git a/src/main/java/tla/web/mvc/config/MvcConfig.java b/src/main/java/tla/web/mvc/config/MvcConfig.java index f89bcf9b..a5b158e3 100644 --- a/src/main/java/tla/web/mvc/config/MvcConfig.java +++ b/src/main/java/tla/web/mvc/config/MvcConfig.java @@ -22,11 +22,11 @@ import tla.web.model.mappings.URLDecodeConverter; import tla.web.mvc.GlobalControllerAdvisor; + @Configuration public class MvcConfig implements WebMvcConfigurer { @Bean - @Autowired public GlobalControllerAdvisor globalAdvisoryController( ApplicationProperties applicationProperties, BuildProperties buildProperties ) { diff --git a/src/test/java/tla/web/mvc/LemmaDetailsTest.java b/src/test/java/tla/web/mvc/LemmaDetailsTest.java index 02f26a67..c78e92a8 100644 --- a/src/test/java/tla/web/mvc/LemmaDetailsTest.java +++ b/src/test/java/tla/web/mvc/LemmaDetailsTest.java @@ -23,7 +23,7 @@ import tla.domain.dto.meta.AbstractDto; import tla.web.model.Lemma; -public class LemmaDetailsTest extends ViewTest { +class LemmaDetailsTest extends ViewTest { private static final String[] EXPECT_TOP_LEVEL_ELEM_IDS = { "lemma-property-dict", @@ -114,7 +114,7 @@ void testLemmaDetails_hieratic(Language lang) throws Exception { void testLemmaDetails_passport() throws Exception { final String id = "151410"; respondToDetailsRequestWithLemma(id); - makeDetailsRequest(id, Language.en).andExpect( + makeDetailsRequest(id, Language.EN).andExpect( xpath("//div[@id='passport-properties']").exists() ).andExpect( xpath("//div[@id='passport-properties']/p/span[@class='lemma_main_group_nominal_schenkel']").nodeCount(1) @@ -125,7 +125,7 @@ void testLemmaDetails_passport() throws Exception { @DisplayName("lemma without passport should be rendered regardless") void testLemmaDetails_noPassport() throws Exception { respondToDetailsRequestWithLemma("875255"); - makeDetailsRequest("875255", Language.en).andExpect( + makeDetailsRequest("875255", Language.EN).andExpect( xpath("//div[@id='lemma-property-type-subtype']//span[@id='type-subtype']/span").string( messages.getMessage("lemma_type_root", null, Locale.ENGLISH) ) @@ -136,7 +136,7 @@ void testLemmaDetails_noPassport() throws Exception { @DisplayName("lemma details page should show attested timespan") void testAttestedTimespan() throws Exception { respondToDetailsRequestWithLemma("100090"); - makeDetailsRequest("100090", Language.en).andExpect( + makeDetailsRequest("100090", Language.EN).andExpect( xpath("//div[@id='lemma-property-attestations']/p/span/span[@id='attestation-timespan-from']/span[1]").string("2375") ).andExpect( xpath("//div[@id='lemma-property-attestations']/p/span/span[@id='attestation-timespan-from']/span[2]").string( @@ -166,7 +166,7 @@ void testLemmaDetails_demotic(Language lang) throws Exception { @Test void testModel() throws Exception { respondToDetailsRequestWithLemma("31610"); - ResultActions testResponse = makeDetailsRequest("31610", Language.en); + ResultActions testResponse = makeDetailsRequest("31610", Language.EN); testResponse.andExpect( model().attributeExists("annotations") ).andExpect( @@ -178,7 +178,7 @@ void testModel() throws Exception { @ValueSource(strings = {"100090"}) void testResponseOk(String id) throws Exception { respondToDetailsRequestWithLemma(id); - makeDetailsRequest(id, Language.en).andExpect( + makeDetailsRequest(id, Language.EN).andExpect( xpath("//div[@id='lemma-property-dict']").exists() ); } diff --git a/src/test/java/tla/web/mvc/ThsEntryDetailsTest.java b/src/test/java/tla/web/mvc/ThsEntryDetailsTest.java index 15955084..c3873cff 100644 --- a/src/test/java/tla/web/mvc/ThsEntryDetailsTest.java +++ b/src/test/java/tla/web/mvc/ThsEntryDetailsTest.java @@ -13,7 +13,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.http.HttpHeaders; import org.springframework.test.web.servlet.ResultActions; @@ -27,9 +27,9 @@ import tla.web.service.ThsService; @Slf4j -public class ThsEntryDetailsTest extends ViewTest { +class ThsEntryDetailsTest extends ViewTest { - @MockBean + @MockitoBean private ThsService service; @Autowired @@ -60,7 +60,7 @@ private ObjectDetails mapDetailsDTO(SingleDocumentWrapper () -> assertEquals(ThsEntry.class, container.getObject().getClass(), "result is ths entry"), () -> assertTrue(container.getObject() instanceof ThsEntry, "result is ths entry instance") ); - return new ObjectDetails( + return new ObjectDetails<>( (ThsEntry) container.getObject(), container.getRelated() ); diff --git a/src/test/java/tla/web/mvc/ViewTest.java b/src/test/java/tla/web/mvc/ViewTest.java index d3c4fce6..65314eb8 100644 --- a/src/test/java/tla/web/mvc/ViewTest.java +++ b/src/test/java/tla/web/mvc/ViewTest.java @@ -1,31 +1,32 @@ package tla.web.mvc; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.MessageSource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import tla.web.repo.TlaClient; -import static org.hamcrest.Matchers.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; - @AutoConfigureMockMvc @SpringBootTest -public class ViewTest { +class ViewTest { // NOSONAR public static enum Language { - en; + EN; } @Autowired protected MockMvc mockMvc; - @MockBean + @MockitoBean protected TlaClient backend; @Autowired @@ -46,7 +47,7 @@ void testLocalization(ResultActions testResponse, String lang) throws Exception } void testLocalization(ResultActions testResponse) throws Exception { - testLocalization(testResponse, Language.en); + testLocalization(testResponse, Language.EN); } } diff --git a/src/test/java/tla/web/service/ServiceTest.java b/src/test/java/tla/web/service/ServiceTest.java index 3eb3ad8e..2333809e 100644 --- a/src/test/java/tla/web/service/ServiceTest.java +++ b/src/test/java/tla/web/service/ServiceTest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import tla.domain.command.LemmaSearch; import tla.domain.command.SentenceSearch; @@ -28,9 +28,9 @@ import tla.web.repo.TlaClient; @SpringBootTest -public class ServiceTest { +class ServiceTest { - @MockBean + @MockitoBean private TlaClient backend; @Autowired @@ -209,4 +209,4 @@ void sentenceServiceTextInjectionSearchResults() throws Exception { ); } -} \ No newline at end of file +}