Skip to content

Commit 6f752e0

Browse files
committed
#165 Pull Request
1 parent 284b278 commit 6f752e0

File tree

4 files changed

+63
-14
lines changed

4 files changed

+63
-14
lines changed

pom.xml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@
4747
</properties>
4848

4949
<dependencies>
50-
<dependency>
51-
<groupId>javax.persistence</groupId>
52-
<artifactId>javax.persistence-api</artifactId>
53-
<version>2.2</version>
54-
</dependency>
55-
<dependency>
56-
<groupId>javax.validation</groupId>
57-
<artifactId>validation-api</artifactId>
58-
<version>1.1.0.Final</version>
59-
</dependency>
6050
<dependency>
6151
<groupId>org.mapstruct</groupId>
6252
<artifactId>mapstruct</artifactId>
@@ -174,7 +164,12 @@
174164
<version>jdk-12.0.1+2</version>
175165
<scope>test</scope>
176166
</dependency>
177-
167+
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
168+
<dependency>
169+
<groupId>org.springframework.boot</groupId>
170+
<artifactId>spring-boot-starter-security</artifactId>
171+
<version>3.1.3</version>
172+
</dependency>
178173

179174
</dependencies>
180175
<build>

src/main/java/de/doubleslash/keeptime/KeepTime.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
import static javafx.application.Application.launch;
2424

25-
@SpringBootApplication
26-
@ComponentScan(basePackages = "de.doubleslash.keeptime")
2725
public class KeepTime {
2826
public static void main(final String[] args) {
2927
launch(App.class, args);

src/main/java/de/doubleslash/keeptime/view/SettingsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ private void initialize() {
269269
}
270270
}
271271
} catch (IOException e) {
272-
e.printStackTrace();
272+
LOG.warn("There is currently no application.properties available");
273273
}
274274

275275
LOG.debug("saveButton.setOnAction");

src/test/java/de/doubleslash/keeptime/REST_API/controller/WorkMapperTest.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package de.doubleslash.keeptime.REST_API.controller;
1919

20+
import de.doubleslash.keeptime.REST_API.DTO.ColorDTO;
21+
import de.doubleslash.keeptime.REST_API.DTO.ProjectDTO;
2022
import de.doubleslash.keeptime.REST_API.DTO.WorkDTO;
2123
import de.doubleslash.keeptime.REST_API.mapper.WorkMapper;
2224
import de.doubleslash.keeptime.model.Project;
@@ -55,4 +57,58 @@ void workToWorkDTO() {
5557

5658
assertEquals(0, workDTO.getProject().getId());
5759
}
60+
61+
// @Test
62+
// void WorkDTOToWork() {
63+
// // ARRANGE
64+
// LocalDateTime startTime = LocalDateTime.of(2024, 4, 19, 9, 0);
65+
// LocalDateTime endTime = LocalDateTime.of(2024, 4, 19, 17, 0);
66+
//
67+
// // Erstellen eines ColorDTO-Objekts für das Projekt
68+
// ColorDTO colorDTO = new ColorDTO();
69+
// colorDTO.setRed(0.0);
70+
// colorDTO.setGreen(0.0);
71+
// colorDTO.setBlue(1.0);
72+
//
73+
// // Erstellen eines ProjectDTO
74+
// ProjectDTO projectDTO = new ProjectDTO(1);
75+
// projectDTO.setId(1);
76+
//
77+
//
78+
// // Erstellen einer WorkDTO
79+
// WorkDTO workDTO = new WorkDTO(1, startTime, endTime, projectDTO, "Did something");
80+
//
81+
// // ACT
82+
// // Konvertieren der WorkDTO in ein Work-Objekt
83+
// Work work = workMapper.workDTOToWork(workDTO);
84+
//
85+
// // ASSERT
86+
// // Überprüfen der notwendigen Felder des erstellten Work-Objekts
87+
// assertEquals(1, work.getId());
88+
//
89+
// }
90+
91+
92+
@Test
93+
public void testWorkDTOToWork() {
94+
// Arrange
95+
LocalDateTime startTime = LocalDateTime.of(2024, 4, 22, 9, 0); // Beispielzeit
96+
LocalDateTime endTime = LocalDateTime.of(2024, 4, 22, 17, 0); // Beispielzeit
97+
ProjectDTO projectDTO = new ProjectDTO(0);
98+
String notes = "Test Notizen";
99+
WorkDTO workDTO = new WorkDTO(1,startTime, endTime, projectDTO, notes);
100+
101+
// Act
102+
Work work = workMapper.workDTOToWork(workDTO);
103+
104+
// Assert
105+
assertNotNull(work);
106+
assertEquals(startTime, work.getStartTime());
107+
assertEquals(endTime, work.getEndTime());
108+
assertNotNull(work.getProject());
109+
assertEquals(projectDTO.getId(), work.getProject().getId());
110+
assertEquals(notes, work.getNotes());
111+
}
112+
113+
58114
}

0 commit comments

Comments
 (0)