Package org.machanism.machai.ai.tools
Class WebFunctionToolsTest
java.lang.Object
org.machanism.machai.ai.tools.WebFunctionToolsTest
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void(package private) void
-
Field Details
-
tempDir
-
-
Constructor Details
-
WebFunctionToolsTest
WebFunctionToolsTest()
-
-
Method Details
-
applyTools_registersBothWebTools
@Test void applyTools_registersBothWebTools() -
applySelectorIfPresent_whenBlankSelector_returnsOriginal
@Test void applySelectorIfPresent_whenBlankSelector_returnsOriginal() -
applySelectorIfPresent_whenSelectorMatches_returnsOuterHtml
@Test void applySelectorIfPresent_whenSelectorMatches_returnsOuterHtml() -
fillHeader_whenHeadersNull_doesNothing
- Throws:
IOException
-
fillHeader_whenHeaderLineMissingEquals_isIgnored
- Throws:
IOException
-
fillHeader_whenHeadersContainPlaceholders_resolvesUsingConfigurator
- Throws:
IOException
-
getWebPage_whenErrorCode_usesErrorStreamAndPrefixesStatusLine
- Throws:
Exception
-
getWebPage_whenSuccess_usesInputStreamAndPrefixesStatusLine
- Throws:
Exception
-
getConnection_whenNoUserInfo_opensConnection
- Throws:
Exception
-
getConnection_whenUserInfoProvided_doesNotIncludeUserInfoInUrlString
- Throws:
Exception
-
callRestApi_whenResponseStreamNull_returnsFallbackMessage
@Test void callRestApi_whenResponseStreamNull_returnsFallbackMessage() -
callRestApi_whenResponseBodyPresent_returnsFullResponseText
- Throws:
Exception
-
callRestApi_whenBodyWithPost_writesBodyAndEnablesOutput
- Throws:
Exception
-
callRestApi_whenCharsetAndHeadersProvided_appliesThemToConnection
- Throws:
Exception
-
callRestApi_whenConnectionThrows_returnsIoErrorMessage
@Test void callRestApi_whenConnectionThrows_returnsIoErrorMessage() -
getWebContent_whenFileSchemeReadsRelativeToWorkingDir_andThenTextOnlyViaReflection
@Test void getWebContent_whenFileSchemeReadsRelativeToWorkingDir_andThenTextOnlyViaReflection() throws Exception- Throws:
Exception
-
getWebContent_whenRelativeFileWithoutPath_returnsIoErrorMessage
@Test void getWebContent_whenRelativeFileWithoutPath_returnsIoErrorMessage() -
getWebContent_whenAbsoluteFileSchemeReadsAbsolutePath
- Throws:
Exception
-
getWebContent_whenSelectorProvidedAndTextOnlyTrue_filtersHtmlThenRendersText
@Test void getWebContent_whenSelectorProvidedAndTextOnlyTrue_filtersHtmlThenRendersText() -
getWebContent_whenHttpSchemeFetchesAndReturnsTextOnly
@Test void getWebContent_whenHttpSchemeFetchesAndReturnsTextOnly() -
getWebContent_whenUrlUsesConfiguratorPlaceholder_replacesBeforeRequest
@Test void getWebContent_whenUrlUsesConfiguratorPlaceholder_replacesBeforeRequest() -
getWebContent_whenExceptionOccurs_returnsIoErrorMessage
@Test void getWebContent_whenExceptionOccurs_returnsIoErrorMessage() -
renderTextOnlyIfRequested_whenFalse_returnsOriginal
@Test void renderTextOnlyIfRequested_whenFalse_returnsOriginal() -
renderTextOnlyIfRequested_whenTrue_rendersPlainText
@Test void renderTextOnlyIfRequested_whenTrue_rendersPlainText()
-