-
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.
- Loading branch information
Showing
9 changed files
with
195 additions
and
6 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ava/servicecourse/CacheConfiguration.java → ...rse/configuration/CacheConfiguration.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
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
18 changes: 18 additions & 0 deletions
18
service-course-api/src/test/java/servicecourse/repo/BikeBrandEntityTest.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,18 @@ | ||
package servicecourse.repo; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import servicecourse.generated.types.BikeBrand; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class BikeBrandEntityTest { | ||
@Test | ||
void asBikeBrand() { | ||
// Given a bike brand | ||
String name = "name"; | ||
BikeBrandEntity entity = BikeBrandEntity.ofName(name); | ||
|
||
// Then the conversion should be correct | ||
assertThat(entity.asBikeBrand()).isEqualTo(BikeBrand.newBuilder().name(name).build()); | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
service-course-api/src/test/java/servicecourse/repo/GroupsetEntityTest.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,34 @@ | ||
package servicecourse.repo; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import servicecourse.generated.types.Groupset; | ||
import servicecourse.generated.types.GroupsetBrand; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class GroupsetEntityTest { | ||
@Test | ||
void asGroupset() { | ||
// Given some attributes | ||
String name = "name"; | ||
GroupsetBrand brand = GroupsetBrand.SHIMANO; | ||
boolean isElectronic = false; | ||
|
||
// Given an entity with those attributes | ||
GroupsetEntity entity = GroupsetEntity.builder() | ||
.name(name) | ||
.brand(brand) | ||
.isElectronic(isElectronic) | ||
.build(); | ||
|
||
// Given the equivalent model | ||
Groupset groupset = Groupset.newBuilder() | ||
.name(name) | ||
.brand(brand) | ||
.isElectronic(isElectronic) | ||
.build(); | ||
|
||
// Then the method applied on the entity should return the groupset equivalent | ||
assertThat(entity.asGroupset()).isEqualTo(groupset); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
service-course-api/src/test/java/servicecourse/repo/ModelEntityTest.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,40 @@ | ||
package servicecourse.repo; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import servicecourse.generated.types.BikeBrand; | ||
import servicecourse.generated.types.Model; | ||
import servicecourse.services.models.ModelId; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class ModelEntityTest { | ||
@Test | ||
void asModel() { | ||
// Given some attributes | ||
Long id = 0L; | ||
String name = "name"; | ||
int modelYear = 2023; | ||
String brandName = "brandName"; | ||
|
||
// Given an entity with those attributes | ||
ModelEntity entity = ModelEntity.builder() | ||
.id(id) | ||
.name(name) | ||
.modelYear(modelYear) | ||
.brandName(brandName) | ||
.build(); | ||
|
||
// Given the equivalent model | ||
Model model = Model.newBuilder() | ||
.id(ModelId.serialize(id)) | ||
.name(name) | ||
.modelYear(modelYear) | ||
.brand(BikeBrand.newBuilder() | ||
.name(brandName) | ||
.build()) | ||
.build(); | ||
|
||
// Then the method applied on the entity should return the model equivalent | ||
assertThat(entity.asModel()).isEqualTo(model); | ||
} | ||
} |