Comments (7)
Harry, I have identified a bug which resulted in the current issue: I was escaping regex pattern characters in stubbed values unnecessarily, which caused that regex matching failures.
from stubby4j.
Version v7.1.2
has been pushed to Maven Central
from stubby4j.
Great to hear, Harry. I will close the current issue
from stubby4j.
Hi Harry,
I quickly wrote a unit test (just for the sake of sanity check) and indeed your provided Regex matches your provided payload:
@Test
public void quickTest() throws Exception {
final Pattern originalPattern = Pattern.compile(".*([^\"Declaration\"\\:]).*\"firstName\":\"(.*?)\".*\"capSubProductCode\":\"(\\w+)\".*\"natureOfProduct\":\"(\\w+)\".*");
final String candidate = "[{\"application\":{\"Address\":[{\"addressId\":8,\"customerId\":1,\"orderItemId\":3,\"addressType\":\"STMT\",\"city\":\"DOCKLANDS\",\"country\":\"AU\",\"postcode\":\"3008\",\"state\":\"VIC\",\"streetName\":\"Collins\",\"streetNumber\":\"691\",\"streetType\":\"ST\"},{\"addressId\":7,\"customerId\":1,\"addressType\":\"CMAL\",\"city\":\"DOCKLANDS\",\"country\":\"AU\",\"postcode\":\"3008\",\"state\":\"VIC\",\"streetName\":\"Collins\",\"streetNumber\":\"691\",\"streetType\":\"ST\"},{\"addressId\":6,\"customerId\":1,\"addressType\":\"CRES\",\"city\":\"DOCKLANDS\",\"country\":\"AU\",\"postcode\":\"3008\",\"state\":\"VIC\",\"streetName\":\"Collins\",\"streetNumber\":\"691\",\"streetType\":\"ST\"}],\"AppCustRelationship\":[{\"customerId\":1,\"applicationId\":2,\"relationshipType\":\"POW\"}],\"Application\":[{\"applicationId\":2,\"applicationSigned\":false,\"applicationSource\":\"sola\",\"applicationSourceCode\":\"QMV\",\"applicationSourceCountry\":\"AU\",\"applicationVersion\":1,\"basketId\":1,\"bsb\":\"\",\"channel\":\"I\",\"createdDate\":\"2021-01-21T09:57:03+11:00\",\"currencyCode\":\"AUD\",\"modifiedBy\":\"Apply User\",\"orderId\":1000000003}],\"CRNRequest\":[{\"regId\":5,\"customerId\":1,\"orderItemId\":3,\"accessLevel\":\"Full\",\"createNewCRN\":true,\"customerClass\":\"CNE\"}],\"Contact\":[{\"contactId\":4,\"customerId\":1,\"contactType\":\"E\",\"email\":\"[email protected]\"}],\"CustOrderItemRelationship\":[{\"customerId\":1,\"orderItemId\":3,\"custAcctRelationship\":\"SOL\",\"orderItemFlag\":\"N\"}],\"Customer\":[{\"customerId\":1,\"acceptMarketing\":true,\"AUTaxResidentOnly\":false,\"customerType\":\"IND\",\"depositCustomerType\":\"STD\",\"existingCustomer\":false,\"fullName\":\"Failure Test\",\"ipAddress\":\"\",\"privacyConsent\":true,\"verificationStatus\":\"Verified\"}],\"Deposit\":[{\"orderItemId\":3,\"ATOType\":\"I\",\"numberOfSignatories\":1,\"transactionAccountType\":\"IND\"}],\"Individual\":[{\"customerId\":1,\"dateOfBirth\":\"1981-01-01T00:00:00Z\",\"firstName\":\"Failure\",\"gender\":\"M\",\"lastName\":\"Test\",\"middleName\":\"\",\"title\":\"mr\"}],\"OrderItem\":[{\"orderItemId\":3,\"capProductCode\":\"DDA\",\"capSubProductCode\":\"ED\",\"eStatementEmail\":\"[email protected]\",\"natureOfProduct\":\"primary\"}]}}]";
final boolean isMatch = originalPattern.matcher(candidate).matches();
Assert.assertTrue(isMatch); // 'isMatch' is true
}
I will look deeper to understand what is happening inside stubby4j
from stubby4j.
Tested also by making a POST to the standalone stubby4j jar using ApiKitchen. Works as expected. I will release a new stubby4j version in order to unblock you
from stubby4j.
Thanks Alex.
from stubby4j.
It's tested and working well in v7.1.3
.
from stubby4j.
Related Issues (20)
- Split yaml config file HOT 12
- How to disable the RegEx pattern cache? HOT 16
- [FEATURE REQUEST] Request proxying HOT 7
- [FEATURE REQUEST] Create a client to simplify configuration through HTTP HOT 3
- [NEW FEATURE RELEASED]: Request Proxying is GA
- [DOCKER HUB]: stubby4j multi architecture Docker images are on DockerHub HOT 3
- [NEW FEATURE RELEASED]: Added support for HTTP/2 over TLS
- [QUESTION] Regex with XML in request.file and response.file HOT 20
- [NEW FEATURE RELEASED]: Added support for WebSocket [RFC6455] over HTTP/1.1 and HTTP/1.1 with TLS
- [SECURITY] Upgrade log4j to 2.16.0 as a vulnerability workaround HOT 3
- [SECURITY] Upgrade log4j to 2.17.0 as a vulnerability workaround HOT 3
- [SECURITY] Upgrade log4j to 2.17.1 as a vulnerability workaround HOT 3
- [ENHANCEMENT] Moving the baseline to JDK 11 and moving to Jetty 11 HOT 2
- [FEATURE REQUEST] We want to have a way to get a count on requests made to stub uri and reset the count for next test to run HOT 5
- for websocket on-message's client request from the text file new line (Enter) not accepted by using of stubby4j any solution or guideline to use new line in requested file, my requirement is, in requested text file must use multiline value HOT 9
- [FEATURE REQUEST] ... Support ARM Docker Images HOT 14
- [QUESTION] Is it possible to configure websocket server to return different results HOT 6
- [QUESTION] Is snakeyaml 2.0 support in scope for next releases? HOT 5
- [BUG] stubb4j testcontainer failing with "exec /bin/sh: exec format error" HOT 7
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 stubby4j.