forked from Onlineberatung/onlineBeratung-appointmentService
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from virtualidentityag/develop
merge to staging
- Loading branch information
Showing
10 changed files
with
280 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/vi/appointmentservice/api/facade/DefaultTextConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.vi.appointmentservice.api.facade; | ||
|
||
public class DefaultTextConstants { | ||
|
||
private DefaultTextConstants() { | ||
// private constructor to hide the implicit public one | ||
} | ||
|
||
public static final String BERATUNG_MIT = "Beratung mit "; | ||
public static final String BERATUNG_MIT_DEM_DER_BERATER_IN = "Beratung mit dem / der Berater:in"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/test/java/com/vi/appointmentservice/api/calcom/repository/ScheduleRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.vi.appointmentservice.api.calcom.repository; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.Set; | ||
import org.junit.Before; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; | ||
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.test.context.TestPropertySource; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@TestPropertySource(properties = "spring.profiles.active=testing") | ||
@AutoConfigureTestDatabase(replace = Replace.ANY) | ||
@ExtendWith(SpringExtension.class) | ||
@SpringBootTest | ||
class ScheduleRepositoryTest { | ||
|
||
@Autowired | ||
ScheduleRepository scheduleRepository; | ||
|
||
@Autowired | ||
JdbcTemplate jdbcTemplate; | ||
|
||
@Before | ||
public void setUp() { | ||
jdbcTemplate.execute("DROP TABLE IF EXISTS \"Schedule\""); | ||
} | ||
@Test | ||
void deleteUserSchedules_Should_DeleteSchedulesPerUserId() { | ||
// given | ||
inititalizeDB(); | ||
|
||
jdbcTemplate.execute("INSERT INTO \"Schedule\" (\"id\", \"userId\", \"name\") VALUES (1, 1, 'DEFAULT_SCHEDULE')"); | ||
jdbcTemplate.execute("INSERT INTO \"Schedule\" (\"id\", \"userId\", \"name\") VALUES (2, 1, 'DEFAULT_SCHEDULE')"); | ||
// when | ||
Set<Integer> integers = scheduleRepository.deleteUserSchedules(1L); | ||
// then | ||
assertThat(integers).containsOnly(1, 2); | ||
|
||
} | ||
|
||
private void inititalizeDB() { | ||
// we can't use @Sql annotation here because it's not visible in jdbcTemplate, | ||
// probably because there are defined multiple jdbc templates in this project for different datasources | ||
jdbcTemplate.execute("create table \"Schedule\"\n" | ||
+ "(\n" | ||
+ " \"id\" integer not null\n" | ||
+ " primary key,\n" | ||
+ " \"userId\" integer not null,\n" | ||
+ " \"name\" varchar(255) not null\n" | ||
+ ");"); | ||
} | ||
|
||
} |
Oops, something went wrong.