Skip to content

Commit

Permalink
added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xuelianhan007 committed Dec 12, 2024
1 parent b2f5c86 commit 3a7ad04
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.consoleconnect.kraken.operator.gateway.runner.ResponseCodeTransform.TARGET_KEY_NOT_FOUND;

import com.consoleconnect.kraken.operator.core.enums.ExpectTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.MappingTypeEnum;
import com.consoleconnect.kraken.operator.core.exception.KrakenException;
import com.consoleconnect.kraken.operator.core.toolkit.JsonToolkit;
import com.consoleconnect.kraken.operator.gateway.CustomConfig;
Expand All @@ -11,6 +12,7 @@
import com.consoleconnect.kraken.operator.test.MockIntegrationTest;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.SneakyThrows;
import org.hamcrest.MatcherAssert;
Expand Down Expand Up @@ -233,4 +235,22 @@ void givenCheckPath_whenCheckExpect_thenReturnException() {
Assertions.assertThrowsExactly(
KrakenException.class, () -> mappingMatrixCheckerActionRunner.checkExpect(pathCheck6, ""));
}

@Test
void givenNonDiscreteString_whenValidating_thenThrowsException() {
Assertions.assertThrowsExactly(
KrakenException.class,
() ->
mappingMatrixCheckerActionRunner.validateDiscreteString(
123, "x", MappingTypeEnum.DISCRETE_STR.getKind()));
}

@Test
void givenValueList_whenValueNotIn_thenThrowsException() {
Assertions.assertThrowsExactly(
KrakenException.class,
() ->
mappingMatrixCheckerActionRunner.validateEnumOrDiscreteString(
"4", "x", List.of("1", "2", "3"), MappingTypeEnum.DISCRETE_STR.getKind()));
}
}

0 comments on commit 3a7ad04

Please sign in to comment.