-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 changed file
with
42 additions
and
7 deletions.
There are no files selected for viewing
49 changes: 42 additions & 7 deletions
49
...ice/src/test/java/org/sagebionetworks/exception/ImageHeightNotSpecifiedExceptionTest.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 |
---|---|---|
@@ -1,22 +1,57 @@ | ||
import org.junit.Test; | ||
package org.sagebionetworks.openchallenges.image.service.exception; | ||
import org.junit.jupiter.api.Test; | ||
import org.sagebionetworks.openchallenges.image.service.exception.ImageHeightNotSpecifiedException; | ||
import org.sagebionetworks.openchallenges.image.service.exception.SimpleChallengeGlobalException; | ||
import org.sagebionetworks.openchallenges.image.service.exception.ErrorConstants; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import static org.assertj.core.api.Assertions.assertEquals; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
|
||
public class ImageHeightNotSpecifiedExceptionTest { | ||
|
||
@Test | ||
public void testConstructor() { | ||
public void ConstructorTypeShouldMatch() { | ||
// Define the exception detail | ||
String detail = "Image height is not specified"; | ||
|
||
// Create an instance of ImageHeightNotSpecifiedException | ||
ImageHeightNotSpecifiedException exception = new ImageHeightNotSpecifiedException(detail); | ||
|
||
// Verify the exception details | ||
assertThat(ErrorConstants.IMAGE_HEIGHT_NOT_SPECIFIED.getType()).isEqualTo(exception.getType()); | ||
} | ||
@Test | ||
public void ConstructorTitle_Match() { | ||
// Define the exception detail | ||
String detail = "Image height is not specified"; | ||
|
||
// Create an instance of ImageHeightNotSpecifiedException | ||
ImageHeightNotSpecifiedException exception = new ImageHeightNotSpecifiedException(detail); | ||
|
||
// Verify the exception details | ||
assertThat(ErrorConstants.IMAGE_HEIGHT_NOT_SPECIFIED.getTitle()).isEqualTo(exception.getTitle()); | ||
} | ||
@Test | ||
public void ConstructorStatusMatch() { | ||
// Define the exception detail | ||
String detail = "Image height is not specified"; | ||
|
||
// Create an instance of ImageHeightNotSpecifiedException | ||
ImageHeightNotSpecifiedException exception = new ImageHeightNotSpecifiedException(detail); | ||
|
||
// Verify the exception details | ||
assertThat(ErrorConstants.IMAGE_HEIGHT_NOT_SPECIFIED.getStatus()).isEqualTo(exception.getStatus()); | ||
} | ||
@Test | ||
public void ConstructorDetailMatch() { | ||
// Define the exception detail | ||
String detail = "Image height is not specified"; | ||
|
||
// Create an instance of ImageHeightNotSpecifiedException | ||
ImageHeightNotSpecifiedException exception = new ImageHeightNotSpecifiedException(detail); | ||
|
||
// Verify the exception details | ||
assertEquals(ErrorConstants.IMAGE_HEIGHT_NOT_SPECIFIED.getType(), exception.getType()); | ||
assertEquals(ErrorConstants.IMAGE_HEIGHT_NOT_SPECIFIED.getTitle(), exception.getTitle()); | ||
assertEquals(ErrorConstants.IMAGE_HEIGHT_NOT_SPECIFIED.getStatus(), exception.getStatus()); | ||
assertEquals(detail, exception.getDetail()); | ||
assertThat(exception.getDetail()).isEqualTo(detail); | ||
} | ||
} |