Skip to content

Commit

Permalink
wrap after first
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Sep 10, 2024
1 parent df9f1d5 commit c9a23fa
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/main/java/ch/puzzle/eft/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class SecurityConfig {
@Bean
protected SecurityFilterChain configure(HttpSecurity http) throws Exception {
return http.cors(Customizer.withDefaults())
.authorizeHttpRequests(e -> e.anyRequest().permitAll())
.authorizeHttpRequests(e -> e.anyRequest()
.permitAll())
.authorizeHttpRequests(authorizationManagerRequestMatcherRegistry -> {})
.build();

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/ch/puzzle/eft/model/ExamFileModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public ExamFileModel(File file) {
}

public String getSubjectName() {
return this.file.getParentFile().getName();
return this.file.getParentFile()
.getName();
}

public String getFileName() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/ch/puzzle/eft/service/ExamFileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public List<ExamFileModel> getMatchingExams(String examNumber, String matriculat
String.format("Keine Prüfungen für die Prüfungslaufnummer %s gefunden",
examNumber));
}
return matchingFiles.stream().map(ExamFileModel::new).toList();
return matchingFiles.stream()
.map(ExamFileModel::new)
.toList();
}

protected String getBasePath() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/formatting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="83"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="82"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ class SiteControllerTest {

@Test
void defaultRouteShouldReturnIndexPage() throws Exception {
this.mockMvc.perform(get("/")).andExpect(status().isOk()).andExpect(view().name("index"));
this.mockMvc.perform(get("/"))
.andExpect(status().isOk())
.andExpect(view().name("index"));
}

@Test
void searchRouteShouldReturnSearchPage() throws Exception {
this.mockMvc.perform(get("/search")).andExpect(status().isOk()).andExpect(view().name("search"));
this.mockMvc.perform(get("/search"))
.andExpect(status().isOk())
.andExpect(view().name("search"));
}

@Test
Expand Down
16 changes: 11 additions & 5 deletions src/test/java/ch/puzzle/eft/service/ExamFileServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ void shouldReturnAllExamFiles() {

List<File> filesToCheck = List.of(Paths.get("static", "Handels und Gesellschaftsrecht", "11000_11112222.pdf")
.toFile(),
Paths.get("static", "Privatrecht", "11000_11112222.pdf").toFile(),
Paths.get("static", "Strafrecht", "11000_11112222.pdf").toFile(),
Paths.get("static", "Öffentliches Recht", "11000_11112222.pdf").toFile());
Paths.get("static", "Privatrecht", "11000_11112222.pdf")
.toFile(),
Paths.get("static", "Strafrecht", "11000_11112222.pdf")
.toFile(),
Paths.get("static", "Öffentliches Recht", "11000_11112222.pdf")
.toFile());

assertEquals(22, result.size());
for (File fileToCheck : filesToCheck) {
Expand Down Expand Up @@ -73,14 +76,17 @@ void shouldReturnMatchingExamNamesAndAmount() {
"static/Öffentliches Recht/11001_22223333.pdf");

List<String> expectedFileNames = filesToCheck.stream()
.map(p -> Paths.get(p).toFile())
.map(p -> Paths.get(p)
.toFile())
.map(ExamFileModel::new)
.map(ExamFileModel::getFileName)
.toList();

List<ExamFileModel> result = examFileService.getMatchingExams("11001", "22223333");

List<String> resultFileNames = result.stream().map(ExamFileModel::getFileName).toList();
List<String> resultFileNames = result.stream()
.map(ExamFileModel::getFileName)
.toList();

assertEquals(resultFileNames, expectedFileNames);
assertIterableEquals(expectedFileNames, resultFileNames, "The lists of exam file names should match");
Expand Down

0 comments on commit c9a23fa

Please sign in to comment.