Skip to content

Commit

Permalink
final image height exception test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsage1 committed Nov 1, 2023
1 parent b21e2be commit e035e39
Showing 1 changed file with 42 additions and 7 deletions.
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);
}
}

0 comments on commit e035e39

Please sign in to comment.