-
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
8 changed files
with
108 additions
and
1 deletion.
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
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
45 changes: 45 additions & 0 deletions
45
src/test/java/de/kamillionlabs/hateoflux/model/hal/HalEmbeddedWrapperTest.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,45 @@ | ||
package de.kamillionlabs.hateoflux.model.hal; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; | ||
|
||
class HalEmbeddedWrapperTest { | ||
|
||
@Test | ||
void givenString_whenWrapping_thenThrowsException() { | ||
assertThatThrownBy(() -> HalEmbeddedWrapper.wrap("hello")) | ||
.isInstanceOf(IllegalArgumentException.class) | ||
.hasMessage("Embedded is not allowed to be of type scalar (e.g. String, int, etc.)"); | ||
} | ||
|
||
@Test | ||
void givenCharacter_whenWrapping_thenThrowsException() { | ||
assertThatThrownBy(() -> HalEmbeddedWrapper.wrap('h')) | ||
.isInstanceOf(IllegalArgumentException.class) | ||
.hasMessage("Embedded is not allowed to be of type scalar (e.g. String, int, etc.)"); | ||
} | ||
|
||
@Test | ||
void givenPrimitiveInt_whenWrapping_thenThrowsException() { | ||
assertThatThrownBy(() -> HalEmbeddedWrapper.wrap(3)) | ||
.isInstanceOf(IllegalArgumentException.class) | ||
.hasMessage("Embedded is not allowed to be of type scalar (e.g. String, int, etc.)"); | ||
} | ||
|
||
@Test | ||
void givenBigDecimal_whenWrapping_thenThrowsException() { | ||
assertThatThrownBy(() -> HalEmbeddedWrapper.wrap(new BigDecimal("4536433.58"))) | ||
.isInstanceOf(IllegalArgumentException.class) | ||
.hasMessage("Embedded is not allowed to be of type scalar (e.g. String, int, etc.)"); | ||
} | ||
|
||
@Test | ||
void givenBoolean_whenWrapping_thenThrowsException() { | ||
assertThatThrownBy(() -> HalEmbeddedWrapper.wrap(false)) | ||
.isInstanceOf(IllegalArgumentException.class) | ||
.hasMessage("Embedded is not allowed to be of type scalar (e.g. String, int, etc.)"); | ||
} | ||
} |
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