सबसे पहले मैं इस किया था -स्ट्रिंग होने के लिए मिलान पैटर्न "{"
Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal repetition
{"hits":[\{"links_count":[0-9]{1,},"forum_count":11}],"totalHitCount":[0-9]{1,}}
तो मैंने किया था (निकल जाता है "{") - -
String str = "{\"hits\":[{\"links_count\":6,\"forum_count\":11}],\"totalHitCount\":1}";
Assert.assertTrue(str.matches("{\"hits\":[{\"links_count\":[0-9]{1,},\"forum_count \":11}],\"totalHitCount\":[0-9]{1,}}"),
"Partnership message does not appear");
यह मैं निम्नलिखित त्रुटि मिली
String str = "\\{\"hits\":[\\{\"links_count\":6,\"forum_count\":11\\}],\"totalHitCount\":1\\}";
Assert.assertTrue(str.matches("\\{\"hits\":[\\{\"links_count\":[0-9]{1,},\"forum_count\":11\\}],\"totalHitCount\":[0-9]{1,}\\}"),
"Partnership message does not appear");
और निम्न त्रुटि मिली -
Exception in thread "main" java.lang.AssertionError: Partnership message does not appear expected:<true> but was:<false>
मुझे यहां क्या याद आ रही है?