2020import org .testingisdocumenting .webtau .data .converters .ObjectProperties ;
2121import org .testingisdocumenting .webtau .data .live .LiveValue ;
2222import org .testingisdocumenting .webtau .expectation .*;
23- import org .testingisdocumenting .webtau .expectation .code .ChangeCodeMatcher ;
23+ import org .testingisdocumenting .webtau .expectation .code .ValueChangeCodeMatcher ;
2424import org .testingisdocumenting .webtau .expectation .code .ThrowExceptionMatcher ;
2525import org .testingisdocumenting .webtau .expectation .contain .ContainAllMatcher ;
2626import org .testingisdocumenting .webtau .expectation .contain .ContainExactlyMatcher ;
@@ -44,6 +44,11 @@ public class Matchers {
4444 */
4545 public static final ValueMatcher anyValue = new AnyValueMatcher ();
4646
47+ /**
48+ * snapshot based value change matcher. Check/wait for value to change/remain the same
49+ */
50+ public static final ValueMatcher change = new SnapshotChangeValueMatcher ();
51+
4752 /**
4853 * visible matcher to check if UI element is visible
4954 * @see #hidden
@@ -62,7 +67,7 @@ public class Matchers {
6267 * actual(value).should(beGreaterThan(10));
6368 * actual(value).shouldNot(beGreaterThan(10));
6469 * </pre>
65- * Note: In Groovy you can do <code>value.should beGreaterThan(10) </code>
70+ * Note: In Groovy you can do <code>value.shouldBe > 10 </code>
6671 * @param actual value to assert against
6772 * @return Object to chain a matcher against
6873 */
@@ -76,7 +81,7 @@ public static <E> ActualValueExpectations actual(E actual) {
7681 * actual(price, "price").should(beGreaterThan(10));
7782 * actual(price, "price").shouldNot(beGreaterThan(10));
7883 * </pre>
79- * Note: In Groovy you can do <code>price.should beGreaterThan(10) </code>
84+ * Note: In Groovy you can do <code>price.shouldBe > 10 </code>
8085 * @param actual value to assert against
8186 * @param path path to use in the reporting
8287 * @return Object to chain a matcher against
@@ -432,8 +437,8 @@ public static ThrowExceptionMatcher throwException(Class<?> expectedClass, Value
432437 * @param valueSupplier value supplier to get before/after values for comparison
433438 * @return code matcher instance
434439 */
435- public static ChangeCodeMatcher change (String label , Supplier <Object > valueSupplier ) {
436- return new ChangeCodeMatcher (label , valueSupplier );
440+ public static ValueChangeCodeMatcher change (String label , Supplier <Object > valueSupplier ) {
441+ return new ValueChangeCodeMatcher (label , valueSupplier );
437442 }
438443
439444 /**
@@ -447,10 +452,10 @@ public static ChangeCodeMatcher change(String label, Supplier<Object> valueSuppl
447452 * @param object object which properties will be extracted for before/after comparison
448453 * @return code matcher instance
449454 */
450- public static ChangeCodeMatcher change (String label , Object object ) {
455+ public static ValueChangeCodeMatcher change (String label , Object object ) {
451456 // case for Groovy closures to avoid them being treated as Java Beans
452457 if (object instanceof Callable ) {
453- return new ChangeCodeMatcher (label , () -> {
458+ return new ValueChangeCodeMatcher (label , () -> {
454459 try {
455460 return ((Callable <?>) object ).call ();
456461 } catch (Exception e ) {
@@ -459,6 +464,6 @@ public static ChangeCodeMatcher change(String label, Object object) {
459464 });
460465 }
461466
462- return new ChangeCodeMatcher (label , () -> new ObjectProperties (object ));
467+ return new ValueChangeCodeMatcher (label , () -> new ObjectProperties (object ));
463468 }
464469}
0 commit comments