#37 Added eBay data src, updated context + tests
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package de.rwu.easydrop.exception;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class DataSourceExceptionTest {
|
||||
|
||||
@Test
|
||||
void constructor_WithMessage_SetsMessage() {
|
||||
// Arrange
|
||||
String message = "Data source error";
|
||||
|
||||
// Act
|
||||
DataSourceException exception = new DataSourceException(message);
|
||||
|
||||
// Assert
|
||||
assertEquals(message, exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_WithMessageAndCause_SetsMessageAndCause() {
|
||||
// Arrange
|
||||
String message = "Data source error";
|
||||
Throwable cause = new IllegalArgumentException("Invalid argument");
|
||||
|
||||
// Act
|
||||
DataSourceException exception = new DataSourceException(message, cause);
|
||||
|
||||
// Assert
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_WithNullMessage_SetsNullMessage() {
|
||||
// Act
|
||||
DataSourceException exception = new DataSourceException(null);
|
||||
|
||||
// Assert
|
||||
assertEquals(null, exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_WithNullCause_SetsNullCause() {
|
||||
// Act
|
||||
DataSourceException exception = new DataSourceException("Data source error", null);
|
||||
|
||||
// Assert
|
||||
assertEquals(null, exception.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
void throw_DataSourceException() {
|
||||
// Act and Assert
|
||||
assertThrows(DataSourceException.class, () -> {
|
||||
throw new DataSourceException("Data source error");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package de.rwu.easydrop.exception;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class InvalidProductExceptionTest {
|
||||
|
||||
@Test
|
||||
void constructor_WithMessage_SetsMessage() {
|
||||
// Arrange
|
||||
String message = "Invalid product data";
|
||||
|
||||
// Act
|
||||
InvalidProductException exception = new InvalidProductException(message);
|
||||
|
||||
// Assert
|
||||
assertEquals(message, exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_WithMessageAndCause_SetsMessageAndCause() {
|
||||
// Arrange
|
||||
String message = "Invalid product data";
|
||||
Throwable cause = new IllegalArgumentException("Invalid argument");
|
||||
|
||||
// Act
|
||||
InvalidProductException exception = new InvalidProductException(message, cause);
|
||||
|
||||
// Assert
|
||||
assertEquals(message, exception.getMessage());
|
||||
assertEquals(cause, exception.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_WithNullMessage_SetsNullMessage() {
|
||||
// Act
|
||||
InvalidProductException exception = new InvalidProductException(null);
|
||||
|
||||
// Assert
|
||||
assertEquals(null, exception.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void constructor_WithNullCause_SetsNullCause() {
|
||||
// Act
|
||||
InvalidProductException exception = new InvalidProductException("Invalid product data", null);
|
||||
|
||||
// Assert
|
||||
assertEquals(null, exception.getCause());
|
||||
}
|
||||
|
||||
@Test
|
||||
void throw_InvalidProductException() {
|
||||
// Act and Assert
|
||||
assertThrows(InvalidProductException.class, () -> {
|
||||
throw new InvalidProductException("Invalid product data");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user