From e035e39f0d67785ba135fe7b0bc231c8d678b9a5 Mon Sep 17 00:00:00 2001 From: mdsage1 Date: Wed, 1 Nov 2023 19:49:10 +0000 Subject: [PATCH] final image height exception test --- .../ImageHeightNotSpecifiedExceptionTest.java | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/apps/openchallenges/image-service/src/test/java/org/sagebionetworks/exception/ImageHeightNotSpecifiedExceptionTest.java b/apps/openchallenges/image-service/src/test/java/org/sagebionetworks/exception/ImageHeightNotSpecifiedExceptionTest.java index ae59fcfe63..3690f15ac8 100644 --- a/apps/openchallenges/image-service/src/test/java/org/sagebionetworks/exception/ImageHeightNotSpecifiedExceptionTest.java +++ b/apps/openchallenges/image-service/src/test/java/org/sagebionetworks/exception/ImageHeightNotSpecifiedExceptionTest.java @@ -1,12 +1,50 @@ -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"; @@ -14,9 +52,6 @@ public void testConstructor() { 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); } }