Comments (4)
The functionality is like:
constructor
When creating a matcher using the constructor, and the pattern is invalid, an exception is thrown immediately.
Like:
[Fact]
public void JsonMatcher_WithInvalidStringValue_Should_ThrowException()
{
// Act
// ReSharper disable once ObjectCreationAsStatement
Action action = () => new JsonMatcher(MatchBehaviour.AcceptOnMatch, "{ \"Id\"");
// Assert
action.Should().Throw<JsonException>();
}
// or this
[Fact]
public void GraphQLMatcher_For_InvalidSchema_ThrowsGraphQLSyntaxErrorException()
{
// Act
// ReSharper disable once ObjectCreationAsStatement
Action action = () => _ = new GraphQLMatcher("in va lid");
// Assert
action.Should().Throw<GraphQLSyntaxErrorException>();
}
during matching
When the input value for the matcher to match on, is invalid, the exception is remembered and returned in the result.
Like:
[Fact]
public void GraphQLMatcher_For_ValidSchema_And_IncorrectQueryWithError_WithThrowExceptionTrue_ReturnsError()
{
// Arrange
var input = "{\"query\":\"{\\r\\n studentsX {\\r\\n fullName\\r\\n X\\r\\n }\\r\\n}\"}";
// Act
var matcher = new GraphQLMatcher(TestSchema);
var result = matcher.IsMatch(input);
// Assert
result.Score.Should().Be(MatchScores.Mismatch);
result.Exception!.Message.Should().StartWith("Cannot query field 'studentsX' on type 'Query'");
}
In the high level mapping matcher code, this error/exception is logged and this mapping is skipped because it contains errors.
Does this help you, you did you actually use it in a different way ?
Because I do not understand this:
it would make my tests fail if an URL changed or a new URL was called by my code not yet covered by my tests
from wiremock.net.
Thank you very much for this answer! I will try it out when I have the chance. I will close this for now
from wiremock.net.
@JasonLandbridge
Sorry, this was indeed a small breaking change introduced in #986 in version 1.5.36 (21 September 2023).
This property was removed, and now you get logging in case the matcher fails.
from wiremock.net.
@StefH Thanks for tracking this down! I actually loved this option as it would make my tests fail if an URL changed or a new URL was called by my code not yet covered by my tests. But now, I assume, the tests can still pass due to the lack of a thrown exception if this happens.
Any chance this option can be returned or is there something similar available?
Cheers!
from wiremock.net.
Related Issues (20)
- Is there a way to access templated data after transformation? HOT 3
- How does WithBody work with request matchers? HOT 5
- Save proxied requests during an XUnit integration test? HOT 7
- Wiremock.net (C#) how to get a PDF from a Request body (form-data ) HOT 2
- External Mapping Storage HOT 21
- Dynamic http status code? HOT 4
- Split WireMock into multiple nuget packages depending on features HOT 5
- Proxying always goes to the root HOT 1
- FluentAssertions extensions do not filter headers correctly HOT 2
- FluentAssertions extensions are not open for extension HOT 2
- Support for multipart formdata in RequestMessage HOT 8
- ProtoBufMatcher not working when proto package name contains dots HOT 2
- ProtoBufMatcher import in proto not working HOT 4
- Use mocked response data in Webhook body data HOT 3
- Compilation Error due to 'MessageOptions' Type Conflict between 'Google.Protobuf' and 'WireMock.Net' HOT 4
- FluentAssertions - Actual body is not displayed in error message when using Json Body HOT 6
- Regex support for JsonMatcher HOT 10
- Wiremock not working with NUnit3 in .Net Framework 4.6.1 after Wiremock 1.5.47 HOT 3
- Feature: support multipart body in `IRequestMessage` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiremock.net.