-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
2367e0a
commit 0450708
Showing
4 changed files
with
43 additions
and
11 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
32 changes: 32 additions & 0 deletions
32
...test/java/com/github/brenoepics/at4j/core/exceptions/AzureExceptionInstantiationTest.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,32 @@ | ||
package com.github.brenoepics.at4j.core.exceptions; | ||
|
||
import com.github.brenoepics.at4j.util.rest.RestRequestInformation; | ||
import com.github.brenoepics.at4j.util.rest.RestRequestResponseInformation; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class AzureExceptionInstantiationTest { | ||
|
||
private final Exception origin = new Exception(); | ||
private final RestRequestInformation request = Mockito.mock(RestRequestInformation.class); | ||
private final RestRequestResponseInformation response = Mockito.mock(RestRequestResponseInformation.class); | ||
private final AzureExceptionInstantiation<AzureException> azureExceptionInstantiation = AzureException::new; | ||
|
||
@Test | ||
void createInstance_withValidInputs_returnsNewInstance() { | ||
String message = "Test message"; | ||
AzureException result = azureExceptionInstantiation.createInstance(origin, message, request, response); | ||
|
||
assertNotNull(result); | ||
assertTrue(result.getRequest().isPresent()); | ||
assertTrue(result.getResponse().isPresent()); | ||
|
||
assertSame(origin, result.getCause()); | ||
assertEquals(message, result.getMessage()); | ||
assertEquals(request, result.getRequest().get()); | ||
assertEquals(response, result.getResponse().get()); | ||
|
||
} | ||
} |