-
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.
Adding some Integration tests for the REST Api for community events
- Loading branch information
1 parent
b66ea59
commit dd7f172
Showing
8 changed files
with
95 additions
and
7 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
14 changes: 14 additions & 0 deletions
14
.../src/main/java/com/softuni/crossfitcommunityevents/exception/ObjectNotFoundException.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,14 @@ | ||
package com.softuni.crossfitcommunityevents.exception; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
@ResponseStatus(code = HttpStatus.NOT_FOUND) | ||
public class ObjectNotFoundException extends RuntimeException{ | ||
|
||
|
||
public ObjectNotFoundException(String message) { | ||
super(message); | ||
|
||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...fit-community-events/src/test/java/com/softuni/crossfitcommunityevents/util/TestData.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,31 @@ | ||
package com.softuni.crossfitcommunityevents.util; | ||
|
||
import com.softuni.crossfitcommunityevents.model.Event; | ||
import com.softuni.crossfitcommunityevents.repository.EventRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Date; | ||
|
||
@Component | ||
public class TestData { | ||
|
||
|
||
private EventRepository eventRepository; | ||
|
||
public TestData(EventRepository eventRepository) { | ||
this.eventRepository = eventRepository; | ||
} | ||
|
||
|
||
public Event createEvent(String eventName, String description, Date date, String address,String videoUrl){ | ||
Event event = Event.builder().eventName(eventName) | ||
.description(description) | ||
.date(date) | ||
.address(address) | ||
.videoUrl(videoUrl) | ||
.build(); | ||
|
||
return this.eventRepository.saveAndFlush(event); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
crossfit-community-events/src/test/resources/application.yaml
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,16 @@ | ||
spring: | ||
datasource: | ||
url: jdbc:hsqldb:mem:testdb;sql.syntax_mys=true | ||
driver-class-name: org.hsqldb.jdbcDriver | ||
username: test | ||
password: test | ||
jpa: | ||
defer-datasource-initialization: true | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
hibernate: | ||
ddl-auto: update | ||
sql: | ||
init: | ||
mode: never |