How to use LastControl class of org.easymock.internal package

Best Easymock code snippet using org.easymock.internal.LastControl

Source:EasyMock.java Github

copy

Full Screen

...67import java.lang.reflect.Proxy;8import java.util.Comparator;910import org.easymock.internal.LastControl;11import org.easymock.internal.MocksControl;12import org.easymock.internal.ObjectMethodsFilter;13import org.easymock.internal.matchers.Any;14import org.easymock.internal.matchers.ArrayEquals;15import org.easymock.internal.matchers.Compare;16import org.easymock.internal.matchers.CompareEqual;17import org.easymock.internal.matchers.Contains;18import org.easymock.internal.matchers.EndsWith;19import org.easymock.internal.matchers.Equals;20import org.easymock.internal.matchers.EqualsWithDelta;21import org.easymock.internal.matchers.Find;22import org.easymock.internal.matchers.GreaterOrEqual;23import org.easymock.internal.matchers.GreaterThan;24import org.easymock.internal.matchers.InstanceOf;25import org.easymock.internal.matchers.LessOrEqual;26import org.easymock.internal.matchers.LessThan;27import org.easymock.internal.matchers.Matches;28import org.easymock.internal.matchers.NotNull;29import org.easymock.internal.matchers.Null;30import org.easymock.internal.matchers.Same;31import org.easymock.internal.matchers.StartsWith;3233public class EasyMock {3435 /**36 * Creates a mock object that implements the given interface, order checking is enabled by default.37 * 38 * @param <T> the interface that the mock object should implement.39 * @param toMock the class of the interface that the mock object should implement.40 * @return the mock object.41 */42 public static <T> T createStrictMock(Class<T> toMock) {43 return createStrictControl().createMock(toMock);44 }4546 /**47 * Creates a mock object that implements the given interface, order checking is enabled by default.48 * 49 * @param name the name of the mock object.50 * @param toMock the class of the interface that the mock object should implement.51 * @param <T> the interface that the mock object should implement.52 * @return the mock object.53 * @throws IllegalArgumentException if the name is not a valid Java identifier.54 */55 public static <T> T createStrictMock(String name, Class<T> toMock) {56 return createStrictControl().createMock(name, toMock);57 }5859 /**60 * Creates a mock object that implements the given interface, order checking is disabled by default.61 * 62 * @param <T> the interface that the mock object should implement.63 * @param toMock the class of the interface that the mock object should implement.64 * @return the mock object.65 */66 public static <T> T createMock(Class<T> toMock) {67 return createControl().createMock(toMock);68 }6970 /**71 * Creates a mock object that implements the given interface, order checking is disabled by default.72 * 73 * @param name the name of the mock object.74 * @param toMock the class of the interface that the mock object should implement.75 * 76 * @param <T> the interface that the mock object should implement.77 * @return the mock object.78 * @throws IllegalArgumentException if the name is not a valid Java identifier.79 */80 public static <T> T createMock(String name, Class<T> toMock) {81 return createControl().createMock(name, toMock);82 }8384 /**85 * Creates a mock object that implements the given interface, order checking is disabled by default, and the mock86 * object will return <code>0</code>, <code>null</code> or <code>false</code> for unexpected invocations.87 * 88 * @param <T> the interface that the mock object should implement.89 * @param toMock the class of the interface that the mock object should implement.90 * @return the mock object.91 */92 public static <T> T createNiceMock(Class<T> toMock) {93 return createNiceControl().createMock(toMock);94 }9596 /**97 * Creates a mock object that implements the given interface, order checking is disabled by default, and the mock98 * object will return <code>0</code>, <code>null</code> or <code>false</code> for unexpected invocations.99 * 100 * @param name the name of the mock object.101 * @param toMock the class of the interface that the mock object should implement.102 * 103 * @param <T> the interface that the mock object should implement.104 * @return the mock object.105 * @throws IllegalArgumentException if the name is not a valid Java identifier.106 */107 public static <T> T createNiceMock(String name, Class<T> toMock) {108 return createNiceControl().createMock(name, toMock);109 }110111 /**112 * Creates a control, order checking is enabled by default.113 * 114 * @return the control.115 */116 public static IMocksControl createStrictControl() {117 return new MocksControl(MocksControl.MockType.STRICT);118 }119120 /**121 * Creates a control, order checking is disabled by default.122 * 123 * @return the control.124 */125 public static IMocksControl createControl() {126 return new MocksControl(MocksControl.MockType.DEFAULT);127 }128129 /**130 * Creates a control, order checking is disabled by default, and the mock objects created by this control will131 * return <code>0</code>, <code>null</code> or <code>false</code> for unexpected invocations.132 * 133 * @return the control.134 */135 public static IMocksControl createNiceControl() {136 return new MocksControl(MocksControl.MockType.NICE);137 }138139 /**140 * Returns the expectation setter for the last expected invocation in the current thread.141 * 142 * @param value the parameter is used to transport the type to the ExpectationSetter. It allows writing the expected143 * call as argument, i.e. <code>expect(mock.getName()).andReturn("John Doe")<code>.144 * 145 * @return the expectation setter.146 */147 @SuppressWarnings("unchecked")148 public static <T> IExpectationSetters<T> expect(T value) {149 return getControlForLastCall();150 }151152 /**153 * Returns the expectation setter for the last expected invocation in the current thread. This method is used for154 * expected invocations on void methods.155 * 156 * @return the expectation setter.157 */158 @SuppressWarnings("unchecked")159 public static IExpectationSetters<Object> expectLastCall() {160 return getControlForLastCall();161 }162163 private static IExpectationSetters getControlForLastCall() {164 MocksControl lastControl = LastControl.lastControl();165 if (lastControl == null) {166 throw new IllegalStateException("no last call on a mock available");167 }168 return lastControl;169 }170171 /**172 * Expects any boolean argument. For details, see the EasyMock documentation.173 * 174 * @return <code>false</code>.175 */176 public static boolean anyBoolean() {177 reportMatcher(Any.ANY);178 return false;179 }180181 /**182 * Expects any byte argument. For details, see the EasyMock documentation.183 * 184 * @return <code>0</code>.185 */186 public static byte anyByte() {187 reportMatcher(Any.ANY);188 return 0;189 }190191 /**192 * Expects any char argument. For details, see the EasyMock documentation.193 * 194 * @return <code>0</code>.195 */196 public static char anyChar() {197 reportMatcher(Any.ANY);198 return 0;199 }200201 /**202 * Expects any int argument. For details, see the EasyMock documentation.203 * 204 * @return <code>0</code>.205 */206 public static int anyInt() {207 reportMatcher(Any.ANY);208 return 0;209 }210211 /**212 * Expects any long argument. For details, see the EasyMock documentation.213 * 214 * @return <code>0</code>.215 */216 public static long anyLong() {217 reportMatcher(Any.ANY);218 return 0;219 }220221 /**222 * Expects any float argument. For details, see the EasyMock documentation.223 * 224 * @return <code>0</code>.225 */226 public static float anyFloat() {227 reportMatcher(Any.ANY);228 return 0;229 }230231 /**232 * Expects any double argument. For details, see the EasyMock documentation.233 * 234 * @return <code>0</code>.235 */236 public static double anyDouble() {237 reportMatcher(Any.ANY);238 return 0;239 }240241 /**242 * Expects any short argument. For details, see the EasyMock documentation.243 * 244 * @return <code>0</code>.245 */246 public static short anyShort() {247 reportMatcher(Any.ANY);248 return 0;249 }250251 /**252 * Expects any Object argument. For details, see the EasyMock documentation.253 * 254 * @return <code>null</code>.255 */256 public static Object anyObject() {257 reportMatcher(Any.ANY);258 return null;259 }260261 /**262 * Expects a comparable argument greater than or equal the given value. For details, see the EasyMock documentation.263 * 264 * @param value the given value.265 * @return <code>null</code>.266 */267 public static <T extends Comparable<T>> T geq(Comparable<T> value) {268 reportMatcher(new GreaterOrEqual<T>(value));269 return null;270 }271272 /**273 * Expects a byte argument greater than or equal to the given value. For details, see the EasyMock documentation.274 * 275 * @param value the given value.276 * @return <code>0</code>.277 */278 public static byte geq(byte value) {279 reportMatcher(new GreaterOrEqual<Byte>(value));280 return 0;281 }282283 /**284 * Expects a double argument greater than or equal to the given value. For details, see the EasyMock documentation.285 * 286 * @param value the given value.287 * @return <code>0</code>.288 */289 public static double geq(double value) {290 reportMatcher(new GreaterOrEqual<Double>(value));291 return 0;292 }293294 /**295 * Expects a float argument greater than or equal to the given value. For details, see the EasyMock documentation.296 * 297 * @param value the given value.298 * @return <code>0</code>.299 */300 public static float geq(float value) {301 reportMatcher(new GreaterOrEqual<Float>(value));302 return 0;303 }304305 /**306 * Expects an int argument greater than or equal to the given value. For details, see the EasyMock documentation.307 * 308 * @param value the given value.309 * @return <code>0</code>.310 */311 public static int geq(int value) {312 reportMatcher(new GreaterOrEqual<Integer>(value));313 return 0;314 }315316 /**317 * Expects a long argument greater than or equal to the given value. For details, see the EasyMock documentation.318 * 319 * @param value the given value.320 * @return <code>0</code>.321 */322 public static long geq(long value) {323 reportMatcher(new GreaterOrEqual<Long>(value));324 return 0;325 }326327 /**328 * Expects a short argument greater than or equal to the given value. For details, see the EasyMock documentation.329 * 330 * @param value the given value.331 * @return <code>0</code>.332 */333 public static short geq(short value) {334 reportMatcher(new GreaterOrEqual<Short>(value));335 return 0;336 }337338 /**339 * Expects a comparable argument less than or equal the given value. For details, see the EasyMock documentation.340 * 341 * @param value the given value.342 * @return <code>null</code>.343 */344 public static <T extends Comparable<T>> T leq(Comparable<T> value) {345 reportMatcher(new LessOrEqual<T>(value));346 return null;347 }348349 /**350 * Expects a byte argument less than or equal to the given value. For details, see the EasyMock documentation.351 * 352 * @param value the given value.353 * @return <code>0</code>.354 */355 public static byte leq(byte value) {356 reportMatcher(new LessOrEqual<Byte>(value));357 return 0;358 }359360 /**361 * Expects a double argument less than or equal to the given value. For details, see the EasyMock documentation.362 * 363 * @param value the given value.364 * @return <code>0</code>.365 */366 public static double leq(double value) {367 reportMatcher(new LessOrEqual<Double>(value));368 return 0;369 }370371 /**372 * Expects a float argument less than or equal to the given value. For details, see the EasyMock documentation.373 * 374 * @param value the given value.375 * @return <code>0</code>.376 */377 public static float leq(float value) {378 reportMatcher(new LessOrEqual<Float>(value));379 return 0;380 }381382 /**383 * Expects an int argument less than or equal to the given value. For details, see the EasyMock documentation.384 * 385 * @param value the given value.386 * @return <code>0</code>.387 */388 public static int leq(int value) {389 reportMatcher(new LessOrEqual<Integer>(value));390 return 0;391 }392393 /**394 * Expects a long argument less than or equal to the given value. For details, see the EasyMock documentation.395 * 396 * @param value the given value.397 * @return <code>0</code>.398 */399 public static long leq(long value) {400 reportMatcher(new LessOrEqual<Long>(value));401 return 0;402 }403404 /**405 * Expects a short argument less than or equal to the given value. For details, see the EasyMock documentation.406 * 407 * @param value the given value.408 * @return <code>0</code>.409 */410 public static short leq(short value) {411 reportMatcher(new LessOrEqual<Short>(value));412 return 0;413 }414415 /**416 * Expects a comparable argument greater than the given value. For details, see the EasyMock documentation.417 * 418 * @param value the given value.419 * @return <code>null</code>.420 */421 public static <T extends Comparable<T>> T gt(Comparable<T> value) {422 reportMatcher(new GreaterThan<T>(value));423 return null;424 }425426 /**427 * Expects a byte argument greater than the given value. For details, see the EasyMock documentation.428 * 429 * @param value the given value.430 * @return <code>0</code>.431 */432 public static byte gt(byte value) {433 reportMatcher(new GreaterThan<Byte>(value));434 return 0;435 }436437 /**438 * Expects a double argument greater than the given value. For details, see the EasyMock documentation.439 * 440 * @param value the given value.441 * @return <code>0</code>.442 */443 public static double gt(double value) {444 reportMatcher(new GreaterThan<Double>(value));445 return 0;446 }447448 /**449 * Expects a float argument greater than the given value. For details, see the EasyMock documentation.450 * 451 * @param value the given value.452 * @return <code>0</code>.453 */454 public static float gt(float value) {455 reportMatcher(new GreaterThan<Float>(value));456 return 0;457 }458459 /**460 * Expects an int argument greater than the given value. For details, see the EasyMock documentation.461 * 462 * @param value the given value.463 * @return <code>0</code>.464 */465 public static int gt(int value) {466 reportMatcher(new GreaterThan<Integer>(value));467 return 0;468 }469470 /**471 * Expects a long argument greater than the given value. For details, see the EasyMock documentation.472 * 473 * @param value the given value.474 * @return <code>0</code>.475 */476 public static long gt(long value) {477 reportMatcher(new GreaterThan<Long>(value));478 return 0;479 }480481 /**482 * Expects a short argument greater than the given value. For details, see the EasyMock documentation.483 * 484 * @param value the given value.485 * @return <code>0</code>.486 */487 public static short gt(short value) {488 reportMatcher(new GreaterThan<Short>(value));489 return 0;490 }491492 /**493 * Expects a comparable argument less than the given value. For details, see the EasyMock documentation.494 * 495 * @param value the given value.496 * @return <code>null</code>.497 */498 public static <T extends Comparable<T>> T lt(Comparable<T> value) {499 reportMatcher(new LessThan<T>(value));500 return null;501 }502503 /**504 * Expects a byte argument less than the given value. For details, see the EasyMock documentation.505 * 506 * @param value the given value.507 * @return <code>0</code>.508 */509 public static byte lt(byte value) {510 reportMatcher(new LessThan<Byte>(value));511 return 0;512 }513514 /**515 * Expects a double argument less than the given value. For details, see the EasyMock documentation.516 * 517 * @param value the given value.518 * @return <code>0</code>.519 */520 public static double lt(double value) {521 reportMatcher(new LessThan<Double>(value));522 return 0;523 }524525 /**526 * Expects a float argument less than the given value. For details, see the EasyMock documentation.527 * 528 * @param value the given value.529 * @return <code>0</code>.530 */531 public static float lt(float value) {532 reportMatcher(new LessThan<Float>(value));533 return 0;534 }535536 /**537 * Expects an int argument less than the given value. For details, see the EasyMock documentation.538 * 539 * @param value the given value.540 * @return <code>0</code>.541 */542 public static int lt(int value) {543 reportMatcher(new LessThan<Integer>(value));544 return 0;545 }546547 /**548 * Expects a long argument less than the given value. For details, see the EasyMock documentation.549 * 550 * @param value the given value.551 * @return <code>0</code>.552 */553 public static long lt(long value) {554 reportMatcher(new LessThan<Long>(value));555 return 0;556 }557558 /**559 * Expects a short argument less than the given value. For details, see the EasyMock documentation.560 * 561 * @param value the given value.562 * @return <code>0</code>.563 */564 public static short lt(short value) {565 reportMatcher(new LessThan<Short>(value));566 return 0;567 }568569 /**570 * Expects an object implementing the given class. For details, see the EasyMock documentation.571 * 572 * @param <T> the accepted type.573 * @param clazz the class of the accepted type.574 * @return <code>null</code>.575 */576 public static <T> T isA(Class<T> clazz) {577 reportMatcher(new InstanceOf(clazz));578 return null;579 }580581 /**582 * Expects a string that contains the given substring. For details, see the EasyMock documentation.583 * 584 * @param substring the substring.585 * @return <code>null</code>.586 */587 public static String contains(String substring) {588 reportMatcher(new Contains(substring));589 return null;590 }591592 /**593 * Expects a boolean that matches both given expectations.594 * 595 * @param first placeholder for the first expectation.596 * @param second placeholder for the second expectation.597 * @return <code>false</code>.598 */599 public static boolean and(boolean first, boolean second) {600 LastControl.reportAnd(2);601 return false;602 }603604 /**605 * Expects a byte that matches both given expectations.606 * 607 * @param first placeholder for the first expectation.608 * @param second placeholder for the second expectation.609 * @return <code>0</code>.610 */611 public static byte and(byte first, byte second) {612 LastControl.reportAnd(2);613 return 0;614 }615616 /**617 * Expects a char that matches both given expectations.618 * 619 * @param first placeholder for the first expectation.620 * @param second placeholder for the second expectation.621 * @return <code>0</code>.622 */623 public static char and(char first, char second) {624 LastControl.reportAnd(2);625 return 0;626 }627628 /**629 * Expects a double that matches both given expectations.630 * 631 * @param first placeholder for the first expectation.632 * @param second placeholder for the second expectation.633 * @return <code>0</code>.634 */635 public static double and(double first, double second) {636 LastControl.reportAnd(2);637 return 0;638 }639640 /**641 * Expects a float that matches both given expectations.642 * 643 * @param first placeholder for the first expectation.644 * @param second placeholder for the second expectation.645 * @return <code>0</code>.646 */647 public static float and(float first, float second) {648 LastControl.reportAnd(2);649 return 0;650 }651652 /**653 * Expects an int that matches both given expectations.654 * 655 * @param first placeholder for the first expectation.656 * @param second placeholder for the second expectation.657 * @return <code>0</code>.658 */659 public static int and(int first, int second) {660 LastControl.reportAnd(2);661 return 0;662 }663664 /**665 * Expects a long that matches both given expectations.666 * 667 * @param first placeholder for the first expectation.668 * @param second placeholder for the second expectation.669 * @return <code>0</code>.670 */671 public static long and(long first, long second) {672 LastControl.reportAnd(2);673 return 0;674 }675676 /**677 * Expects a short that matches both given expectations.678 * 679 * @param first placeholder for the first expectation.680 * @param second placeholder for the second expectation.681 * @return <code>0</code>.682 */683 public static short and(short first, short second) {684 LastControl.reportAnd(2);685 return 0;686 }687688 /**689 * Expects an Object that matches both given expectations.690 * 691 * @param <T> the type of the object, it is passed through to prevent casts.692 * @param first placeholder for the first expectation.693 * @param second placeholder for the second expectation.694 * @return <code>null</code>.695 */696 public static <T> T and(T first, T second) {697 LastControl.reportAnd(2);698 return null;699 }700701 /**702 * Expects a boolean that matches one of the given expectations.703 * 704 * @param first placeholder for the first expectation.705 * @param second placeholder for the second expectation.706 * @return <code>false</code>.707 */708 public static boolean or(boolean first, boolean second) {709 LastControl.reportOr(2);710 return false;711 }712713 /**714 * Expects a byte that matches one of the given expectations.715 * 716 * @param first placeholder for the first expectation.717 * @param second placeholder for the second expectation.718 * @return <code>0</code>.719 */720 public static byte or(byte first, byte second) {721 LastControl.reportOr(2);722 return 0;723 }724725 /**726 * Expects a char that matches one of the given expectations.727 * 728 * @param first placeholder for the first expectation.729 * @param second placeholder for the second expectation.730 * @return <code>0</code>.731 */732 public static char or(char first, char second) {733 LastControl.reportOr(2);734 return 0;735 }736737 /**738 * Expects a double that matches one of the given expectations.739 * 740 * @param first placeholder for the first expectation.741 * @param second placeholder for the second expectation.742 * @return <code>0</code>.743 */744 public static double or(double first, double second) {745 LastControl.reportOr(2);746 return 0;747 }748749 /**750 * Expects a float that matches one of the given expectations.751 * 752 * @param first placeholder for the first expectation.753 * @param second placeholder for the second expectation.754 * @return <code>0</code>.755 */756 public static float or(float first, float second) {757 LastControl.reportOr(2);758 return 0;759 }760761 /**762 * Expects an int that matches one of the given expectations.763 * 764 * @param first placeholder for the first expectation.765 * @param second placeholder for the second expectation.766 * @return <code>0</code>.767 */768 public static int or(int first, int second) {769 LastControl.reportOr(2);770 return first;771 }772773 /**774 * Expects a long that matches one of the given expectations.775 * 776 * @param first placeholder for the first expectation.777 * @param second placeholder for the second expectation.778 * @return <code>0</code>.779 */780 public static long or(long first, long second) {781 LastControl.reportOr(2);782 return 0;783 }784785 /**786 * Expects a short that matches one of the given expectations.787 * 788 * @param first placeholder for the first expectation.789 * @param second placeholder for the second expectation.790 * @return <code>0</code>.791 */792 public static short or(short first, short second) {793 LastControl.reportOr(2);794 return 0;795 }796797 /**798 * Expects an Object that matches one of the given expectations.799 * 800 * @param <T> the type of the object, it is passed through to prevent casts.801 * @param first placeholder for the first expectation.802 * @param second placeholder for the second expectation.803 * @return <code>null</code>.804 */805 public static <T> T or(T first, T second) {806 LastControl.reportOr(2);807 return null;808 }809810 /**811 * Expects a boolean that does not match the given expectation.812 * 813 * @param first placeholder for the expectation.814 * @return <code>false</code>.815 */816 public static boolean not(boolean first) {817 LastControl.reportNot();818 return false;819 }820821 /**822 * Expects a byte that does not match the given expectation.823 * 824 * @param first placeholder for the expectation.825 * @return <code>0</code>.826 */827 public static byte not(byte first) {828 LastControl.reportNot();829 return 0;830 }831832 /**833 * Expects a char that does not match the given expectation.834 * 835 * @param first placeholder for the expectation.836 * @return <code>0</code>.837 */838 public static char not(char first) {839 LastControl.reportNot();840 return 0;841 }842843 /**844 * Expects a double that does not match the given expectation.845 * 846 * @param first placeholder for the expectation.847 * @return <code>0</code>.848 */849 public static double not(double first) {850 LastControl.reportNot();851 return 0;852 }853854 /**855 * Expects a float that does not match the given expectation.856 * 857 * @param first placeholder for the expectation.858 * @return <code>0</code>.859 */860 public static float not(float first) {861 LastControl.reportNot();862 return first;863 }864865 /**866 * Expects an int that does not match the given expectation.867 * 868 * @param first placeholder for the expectation.869 * @return <code>0</code>.870 */871 public static int not(int first) {872 LastControl.reportNot();873 return 0;874 }875876 /**877 * Expects a long that does not match the given expectation.878 * 879 * @param first placeholder for the expectation.880 * @return <code>0</code>.881 */882 public static long not(long first) {883 LastControl.reportNot();884 return 0;885 }886887 /**888 * Expects a short that does not match the given expectation.889 * 890 * @param first placeholder for the expectation.891 * @return <code>0</code>.892 */893 public static short not(short first) {894 LastControl.reportNot();895 return 0;896 }897898 /**899 * Expects an Object that does not match the given expectation.900 * 901 * @param <T> the type of the object, it is passed through to prevent casts.902 * @param first placeholder for the expectation.903 * @return <code>null</code>.904 */905 public static <T> T not(T first) {906 LastControl.reportNot();907 return null;908 }909910 /**911 * Expects a boolean that is equal to the given value.912 * 913 * @param value the given value.914 * @return <code>0</code>.915 */916 public static boolean eq(boolean value) {917 reportMatcher(new Equals(value));918 return false;919 }920921 /**922 * Expects a byte that is equal to the given value.923 * 924 * @param value the given value.925 * @return <code>0</code>.926 */927 public static byte eq(byte value) {928 reportMatcher(new Equals(value));929 return 0;930 }931932 /**933 * Expects a char that is equal to the given value.934 * 935 * @param value the given value.936 * @return <code>0</code>.937 */938 public static char eq(char value) {939 reportMatcher(new Equals(value));940 return 0;941 }942943 /**944 * Expects a double that is equal to the given value.945 * 946 * @param value the given value.947 * @return <code>0</code>.948 */949 public static double eq(double value) {950 reportMatcher(new Equals(value));951 return 0;952 }953954 /**955 * Expects a float that is equal to the given value.956 * 957 * @param value the given value.958 * @return <code>0</code>.959 */960 public static float eq(float value) {961 reportMatcher(new Equals(value));962 return 0;963 }964965 /**966 * Expects an int that is equal to the given value.967 * 968 * @param value the given value.969 * @return <code>0</code>.970 */971 public static int eq(int value) {972 reportMatcher(new Equals(value));973 return 0;974 }975976 /**977 * Expects a long that is equal to the given value.978 * 979 * @param value the given value.980 * @return <code>0</code>.981 */982 public static long eq(long value) {983 reportMatcher(new Equals(value));984 return 0;985 }986987 /**988 * Expects a short that is equal to the given value.989 * 990 * @param value the given value.991 * @return <code>0</code>.992 */993 public static short eq(short value) {994 reportMatcher(new Equals(value));995 return 0;996 }997998 /**999 * Expects an Object that is equal to the given value.1000 * 1001 * @param value the given value.1002 * @return <code>null</code>.1003 */1004 public static <T> T eq(T value) {1005 reportMatcher(new Equals(value));1006 return null;1007 }10081009 /**1010 * Expects a boolean array that is equal to the given array, i.e. it has to have the same length, and each element1011 * has to be equal.1012 * 1013 * @param value the given arry.1014 * @return <code>null</code>.1015 */1016 public static boolean[] aryEq(boolean[] value) {1017 reportMatcher(new ArrayEquals(value));1018 return null;1019 }10201021 /**1022 * Expects a byte array that is equal to the given array, i.e. it has to have the same length, and each element has1023 * to be equal.1024 * 1025 * @param value the given arry.1026 * @return <code>null</code>.1027 */1028 public static byte[] aryEq(byte[] value) {1029 reportMatcher(new ArrayEquals(value));1030 return null;1031 }10321033 /**1034 * Expects a char array that is equal to the given array, i.e. it has to have the same length, and each element has1035 * to be equal.1036 * 1037 * @param value the given arry.1038 * @return <code>null</code>.1039 */1040 public static char[] aryEq(char[] value) {1041 reportMatcher(new ArrayEquals(value));1042 return null;1043 }10441045 /**1046 * Expects a double array that is equal to the given array, i.e. it has to have the same length, and each element1047 * has to be equal.1048 * 1049 * @param value the given arry.1050 * @return <code>null</code>.1051 */1052 public static double[] aryEq(double[] value) {1053 reportMatcher(new ArrayEquals(value));1054 return null;1055 }10561057 /**1058 * Expects a float array that is equal to the given array, i.e. it has to have the same length, and each element has1059 * to be equal.1060 * 1061 * @param value the given arry.1062 * @return <code>null</code>.1063 */1064 public static float[] aryEq(float[] value) {1065 reportMatcher(new ArrayEquals(value));1066 return null;1067 }10681069 /**1070 * Expects an int array that is equal to the given array, i.e. it has to have the same length, and each element has1071 * to be equal.1072 * 1073 * @param value the given arry.1074 * @return <code>null</code>.1075 */1076 public static int[] aryEq(int[] value) {1077 reportMatcher(new ArrayEquals(value));1078 return null;1079 }10801081 /**1082 * Expects a long array that is equal to the given array, i.e. it has to have the same length, and each element has1083 * to be equal.1084 * 1085 * @param value the given arry.1086 * @return <code>null</code>.1087 */1088 public static long[] aryEq(long[] value) {1089 reportMatcher(new ArrayEquals(value));1090 return null;1091 }10921093 /**1094 * Expects a short array that is equal to the given array, i.e. it has to have the same length, and each element has1095 * to be equal.1096 * 1097 * @param value the given arry.1098 * @return <code>null</code>.1099 */1100 public static short[] aryEq(short[] value) {1101 reportMatcher(new ArrayEquals(value));1102 return null;1103 }11041105 /**1106 * Expects an Object array that is equal to the given array, i.e. it has to have the same type, length, and each1107 * element has to be equal.1108 * 1109 * @param <T> the type of the array, it is passed through to prevent casts.1110 * @param value the given arry.1111 * @return <code>null</code>.1112 */1113 public static <T> T[] aryEq(T[] value) {1114 reportMatcher(new ArrayEquals(value));1115 return null;1116 }11171118 /**1119 * Expects null.1120 * 1121 * @return <code>null</code>.1122 */1123 public static Object isNull() {1124 reportMatcher(Null.NULL);1125 return null;1126 }11271128 /**1129 * Expects not null.1130 * 1131 * @return <code>null</code>.1132 */1133 public static Object notNull() {1134 reportMatcher(NotNull.NOT_NULL);1135 return null;1136 }11371138 /**1139 * Expects a string that contains a substring that matches the given regular expression. For details, see the1140 * EasyMock documentation.1141 * 1142 * @param regex the regular expression.1143 * @return <code>null</code>.1144 */1145 public static String find(String regex) {1146 reportMatcher(new Find(regex));1147 return null;1148 }11491150 /**1151 * Expects a string that matches the given regular expression. For details, see the EasyMock documentation.1152 * 1153 * @param regex the regular expression.1154 * @return <code>null</code>.1155 */1156 public static String matches(String regex) {1157 reportMatcher(new Matches(regex));1158 return null;1159 }11601161 /**1162 * Expects a string that starts with the given prefix. For details, see the EasyMock documentation.1163 * 1164 * @param prefix the prefix.1165 * @return <code>null</code>.1166 */1167 public static String startsWith(String prefix) {1168 reportMatcher(new StartsWith(prefix));1169 return null;1170 }11711172 /**1173 * Expects a string that ends with the given suffix. For details, see the EasyMock documentation.1174 * 1175 * @param suffix the suffix.1176 * @return <code>null</code>.1177 */1178 public static String endsWith(String suffix) {1179 reportMatcher(new EndsWith(suffix));1180 return null;1181 }11821183 /**1184 * Expects a double that has an absolute difference to the given value that is less than the given delta. For1185 * details, see the EasyMock documentation.1186 * 1187 * @param value the given value.1188 * @param delta the given delta.1189 * @return <code>0</code>.1190 */1191 public static double eq(double value, double delta) {1192 reportMatcher(new EqualsWithDelta(value, delta));1193 return 0;1194 }11951196 /**1197 * Expects a float that has an absolute difference to the given value that is less than the given delta. For1198 * details, see the EasyMock documentation.1199 * 1200 * @param value the given value.1201 * @param delta the given delta.1202 * @return <code>0</code>.1203 */1204 public static float eq(float value, float delta) {1205 reportMatcher(new EqualsWithDelta(value, delta));1206 return 0;1207 }12081209 /**1210 * Expects an Object that is the same as the given value. For details, see the EasyMock documentation.1211 * 1212 * @param <T> the type of the object, it is passed through to prevent casts.1213 * @param value the given value.1214 * @return <code>null</code>.1215 */1216 public static <T> T same(T value) {1217 reportMatcher(new Same(value));1218 return null;1219 }12201221 /**1222 * Switches the given mock objects (more exactly: the controls of the mock objects) to replay mode. For details, see1223 * the EasyMock documentation.1224 * 1225 * @param mocks the mock objects.1226 */1227 public static void replay(Object... mocks) {1228 for (Object mock : mocks) {1229 getControl(mock).replay();1230 }1231 }12321233 /**1234 * Resets the given mock objects (more exactly: the controls of the mock objects). For details, see the EasyMock1235 * documentation.1236 * 1237 * @param mocks the mock objects.1238 */1239 public static void reset(Object... mocks) {1240 for (Object mock : mocks) {1241 getControl(mock).reset();1242 }1243 }12441245 /**1246 * Verifies the given mock objects (more exactly: the controls of the mock objects).1247 * 1248 * @param mocks the mock objects.1249 */1250 public static void verify(Object... mocks) {1251 for (Object mock : mocks) {1252 getControl(mock).verify();1253 }1254 }12551256 /**1257 * Switches order checking of the given mock object (more exactly: the control of the mock object) the on and off.1258 * For details, see the EasyMock documentation.1259 * 1260 * @param mock the mock object.1261 * @param state <code>true</code> switches order checking on, <code>false</code> switches it off.1262 */1263 public static void checkOrder(Object mock, boolean state) {1264 getControl(mock).checkOrder(state);1265 }12661267 /**1268 * Reports an argument matcher. This method is needed to define own argument matchers. For details, see the EasyMock1269 * documentation.1270 * 1271 * @param matcher1272 */1273 public static void reportMatcher(IArgumentMatcher matcher) {1274 LastControl.reportMatcher(matcher);1275 }12761277 private static MocksControl getControl(Object mock) {1278 return ((ObjectMethodsFilter) Proxy.getInvocationHandler(mock)).getDelegate().getControl();1279 }12801281 /**1282 * Returns the arguments of the current mock method call, if inside an <code>IAnswer</code> callback - be careful1283 * here, reordering parameters of method changes the semantics of your tests.1284 * 1285 * @return the arguments of the current mock method call.1286 * @throws IllegalStateException if called outside of <code>IAnswer</code> callbacks.1287 */1288 public static Object[] getCurrentArguments() {1289 Object[] result = LastControl.getCurrentArguments();1290 if (result == null) {1291 throw new IllegalStateException("current arguments are only available when executing callback methods");1292 }1293 return result;1294 }12951296 /**1297 * Expects a comparable argument equals to the given value according to their compareTo method. For details, see the1298 * EasyMock documentation.1299 * 1300 * @param value the given value.1301 * @return <code>null</code>.1302 */1303 public static <T extends Comparable<T>> T cmpEq(Comparable<T> value) { ...

Full Screen

Full Screen

Source:LenientMocksControl.java Github

copy

Full Screen

...18import org.easymock.IAnswer;19import org.easymock.IArgumentMatcher;20import org.easymock.internal.IMocksControlState;21import org.easymock.internal.Invocation;22import org.easymock.internal.LastControl;23import org.easymock.internal.MocksControl;24import org.easymock.internal.Range;25import org.easymock.internal.RecordState;26import org.unitils.reflectionassert.ReflectionComparatorMode;27/**28 * An EasyMock mock control that uses the reflection argument matcher for all arguments of a method invocation.29 * <p/>30 * No explicit argument matcher setting is needed (or allowed). This control will automatically report31 * lenient reflection argument matchers. These matchers can apply some leniency when comparing expected and actual32 * argument values.33 * <p/>34 * Setting the {@link ReflectionComparatorMode#IGNORE_DEFAULTS} mode will for example ignore all fields that35 * have default values as expected values. E.g. if a null value is recorded as argument it will not be checked when36 * the actual invocation occurs. The same applies for inner-fields of object arguments that contain default java values.37 * <p/>38 * Setting the {@link ReflectionComparatorMode#LENIENT_DATES} mode will ignore the actual date values of arguments and39 * inner fields of arguments. It will only check whether both dates are null or both dates are not null. The actual40 * date and hour do not matter.41 * <p/>42 * Setting the {@link ReflectionComparatorMode#LENIENT_ORDER} mode will ignore the actual order of collections and43 * arrays arguments and inner fields of arguments. It will only check whether they both contain the same elements.44 *45 * @author Tim Ducheyne46 * @author Filip Neven47 * @see ReflectionComparatorMode48 * @see org.unitils.reflectionassert.ReflectionComparator49 */50public class LenientMocksControl extends MocksControl {51 /***/52 private static final long serialVersionUID = -4612378998272988410L;53 /* The interceptor that wraps the record state */54 private InvocationInterceptor invocationInterceptor;55 /**56 * Creates a default (no default returns and no order checking) mock control.57 *58 * @param modes the modes for the reflection argument matcher59 */60 public LenientMocksControl(ReflectionComparatorMode... modes) {61 this(org.easymock.MockType.DEFAULT, modes);62 }63 /**64 * Creates a mock control.<ul>65 * <li>Default mock type: no default return values and no order checking</li>66 * <li>Nice mock type: returns default values if no return value set, no order checking</li>67 * <li>Strict mock type: no default return values and strict order checking</li>68 * </ul>69 *70 * @param type the EasyMock mock type71 * @param modes the modes for the reflection argument matcher72 */73 public LenientMocksControl(org.easymock.MockType type, ReflectionComparatorMode... modes) {74 super(type);75 this.invocationInterceptor = new InvocationInterceptor(modes);76 }77 /**78 * Overriden to be able to replace the record behavior that going to record all method invocations.79 * The interceptor will make sure that reflection argument matchers will be reported for the80 * arguments of all recorded method invocations.81 *82 * @return the state, wrapped in case of a RecordState83 */84 @Override85 public IMocksControlState getState() {86 IMocksControlState mocksControlState = super.getState();87 if (mocksControlState instanceof RecordState) {88 invocationInterceptor.setRecordState((RecordState) mocksControlState);89 return invocationInterceptor;90 }91 return mocksControlState;92 }93 /**94 * A wrapper for the record state in easy mock that will intercept the invoke method95 * so that it can install reflection argument matchers for all arguments of the recorded method invocation.96 * <p/>97 * The old easy mock way of having a single argument matcher for all arguments has been deprecated. Since98 * EasyMock 2 each argument should have its own matcher. We however want to avoid having to set all99 * matchers to the reflection argument matcher explicitly.100 * Because some of the methods are declared final and some classes explicitly cast to subtypes, creating a wrapper101 * seems to be the only way to be able to intercept the matcher behavior.102 */103 private class InvocationInterceptor implements IMocksControlState {104 /* The wrapped record state */105 private RecordState recordState;106 /* The modes for the reflection argument matchers */107 private ReflectionComparatorMode[] modes;108 /**109 * Creates an interceptor that will create reflection argument matchers for all arguments of all recorded110 * method invocations.111 *112 * @param modes the modes for the reflection argument matchers113 */114 public InvocationInterceptor(ReflectionComparatorMode... modes) {115 this.modes = modes;116 }117 /**118 * Sets the current wrapped record state.119 *120 * @param recordState the state, not null121 */122 public void setRecordState(RecordState recordState) {123 this.recordState = recordState;124 }125 /**126 * Overriden to report reflection argument matchers for all arguments of the given method invocation.127 *128 * @param invocation the method invocation, not null129 * @return the result of the invocation130 */131 @Override132 public Object invoke(Invocation invocation) {133 LastControl.reportLastControl(LenientMocksControl.this);134 createMatchers(invocation);135 return recordState.invoke(invocation);136 }137 /**138 * Reports report reflection argument matchers for all arguments of the given method invocation.139 * An exception will be thrown if there were already matchers reported for the invocation.140 *141 * @param invocation the method invocation, not null142 */143 private void createMatchers(Invocation invocation) {144 List<IArgumentMatcher> matchers = LastControl.pullMatchers();145 if (matchers != null && !matchers.isEmpty()) {146 if (matchers.size() != invocation.getArguments().length) {147 throw new IllegalStateException("This mock control does not support mixing of no-argument matchers and per-argument matchers. " +148 "Either no matchers are defined and the reflection argument matcher is used by default or all matchers are defined explicitly (Eg by using refEq()).");149 }150 // put all matchers back since pull removes them151 for (IArgumentMatcher matcher : matchers) {152 LastControl.reportMatcher(matcher);153 }154 return;155 }156 Object[] arguments = invocation.getArguments();157 if (arguments == null) {158 return;159 }160 for (Object argument : arguments) {161 LastControl.reportMatcher(new ReflectionArgumentMatcher<Object>(argument, modes));162 }163 }164 // Pass through delegation165 @Override166 public void assertRecordState() {167 recordState.assertRecordState();168 }169 @Override170 public void andReturn(Object value) {171 recordState.andReturn(value);172 }173 @Override174 public void andThrow(Throwable throwable) {175 recordState.andThrow(throwable);...

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1import org.easymock.internal.LastControl;2import org.easymock.MockControl;3import org.easymock.EasyMock;4public class 1 {5 public static void main(String[] args) {6 MockControl control = EasyMock.createControl();7 LastControl.setLastControl(control);8 control.verify();9 }10}11import org.easymock.internal.LastControl;12import org.easymock.MockControl;13import org.easymock.EasyMock;14import junit.framework.TestCase;15public class 1Test extends TestCase {16 public void test1() {17 MockControl control = EasyMock.createControl();18 LastControl.setLastControl(control);19 control.verify();20 }21}22import org.easymock.internal.LastControl;23import org.easymock.MockControl;24import org.easymock.EasyMock;25import junit.framework.TestCase;26public class 1Test extends TestCase {27 public void test1() {28 MockControl control = EasyMock.createControl();29 LastControl.setLastControl(control);30 control.verify();31 }32}33import org.easymock.internal.LastControl;34import org.easymock.MockControl;35import org.easymock.EasyMock;

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1import org.easymock.internal.LastControl;2import org.easymock.EasyMock;3import org.easymock.IMocksControl;4import org.easymock.internal.LastControl;5import org.junit.Test;6import static org.easymock.EasyMock.*;7import static org.junit.Assert.*;8public class Test1 {9 public void test1() {10 IMocksControl control = EasyMock.createControl();11 LastControl lastControl = new LastControl(control);12 lastControl.andReturn("Hello World");13 control.replay();14 assertEquals("Hello World", lastControl.getLastReturnValue());15 control.verify();16 }17}18 at Test1.test1(Test1.java:10)19 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)20 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)21 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)22 at java.lang.reflect.Method.invoke(Method.java:498)23 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)24 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)25 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)26 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)27 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)28 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)29 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)30 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)31 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)32 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)33 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)34 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)35 at org.junit.runners.ParentRunner.run(ParentRunner.java:363

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1import org.easymock.internal.LastControl;2import org.easymock.EasyMock;3import org.easymock.IMocksControl;4import org.junit.Test;5import static org.junit.Assert.*;6public class LastControlTest {7 public void testLastControl() {8 IMocksControl control = EasyMock.createControl();9 LastControl lastControl = new LastControl(control);10 assertEquals(control, lastControl.getMockControl());11 }12}13import org.easymock.internal.LastControl;14import org.easymock.EasyMock;15import org.easymock.IMocksControl;16import org.junit.Test;17import static org.junit.Assert.*;18public class LastControlTest {19 public void testLastControl() {20 IMocksControl control = EasyMock.createControl();21 LastControl lastControl = new LastControl(control);22 assertEquals(control, lastControl.getMockControl());23 }24}25import org.easymock.internal.LastControl;26import org.easymock.EasyMock;27import org.easymock.IMocksControl;28import org.junit.Test;29import static org.junit.Assert.*;30public class LastControlTest {31 public void testLastControl() {32 IMocksControl control = EasyMock.createControl();33 LastControl lastControl = new LastControl(control);34 assertEquals(control, lastControl.getMockControl());35 }36}

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1import org.easymock.internal.LastControl;2import org.easymock.internal.MocksControl;3class 1 {4 public static void main(String[] args) {5 MocksControl mocksControl = new MocksControl();6 LastControl lastControl = new LastControl(mocksControl);7 lastControl.setReturnValue("Hello World");8 System.out.println(lastControl.getReturnValue());9 }10}

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1import org.easymock.internal.LastControl;2public class 1 {3 public static void main(String[] args) {4 LastControl control = new LastControl();5 control.setReturnValue("value");6 System.out.println(control.getReturnValue());7 }8}

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1public class LastControlTest {2 public static void main(String[] args) {3 LastControl lastControl = new LastControl();4 System.out.println(lastControl);5 }6}

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1package org.easymock.internal;2import java.lang.reflect.InvocationTargetException;3import java.lang.reflect.Method;4import java.util.*;5import org.easymock.*;6public class LastControl {7public static void main(String[] args) throws Exception {8List mockList = EasyMock.createMock(List.class);9mockList.add("hello");10mockList.add("world");11mockList.add("goodbye");12EasyMock.replay(mockList);13mockList.add("hello");14mockList.add("world");15mockList.add("goodbye");16mockList.add("hello");17mockList.add("world");18mockList.add("goodbye");19EasyMock.replay(mockList);20mockList.add("hello");21mockList.add("world");22mockList.add("goodbye");23EasyMock.replay(mockList);24mockList.add("hello");25mockList.add("world");26mockList.add("goodbye");27EasyMock.replay(mockList);28mockList.add("hello");29mockList.add("world");30mockList.add("goodbye");31EasyMock.replay(mockList);32mockList.add("hello");33mockList.add("world");34mockList.add("goodbye");35EasyMock.replay(mockList);36mockList.add("hello");37mockList.add("world");38mockList.add("goodbye");39EasyMock.replay(mockList);40mockList.add("hello");41mockList.add("world");42mockList.add("goodbye");43EasyMock.replay(mockList);44mockList.add("hello");45mockList.add("world");46mockList.add("goodbye");47EasyMock.replay(mockList);48mockList.add("hello");49mockList.add("world");50mockList.add("goodbye");51EasyMock.replay(mockList);52mockList.add("hello");53mockList.add("world");54mockList.add("goodbye");

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1package org.easymock.internal;2import java.lang.reflect.*;3import java.util.*;4public class LastControl {5public static void main(String[] args) {6LastControl lc = new LastControl();7lc.test();8}9public void test() {10try {11Class c = Class.forName("org.easymock.internal.LastControl");12Method m = c.getDeclaredMethod("getLastControl");13m.setAccessible(true);14Object o = m.invoke(this);15System.out.println("LastControl is: " + o);16} catch (Exception e) {17e.printStackTrace();18}19}20}21package org.easymock.internal;22public class LastControl {23public static void main(String[] args) {24LastControl lc = new LastControl();25lc.test();26}27public void test() {28try {29Class c = Class.forName("org.easymock.internal.LastControl");30Method m = c.getDeclaredMethod("getLastControl");31m.setAccessible(true);32Object o = m.invoke(this);33System.out.println("LastControl is: " + o);34} catch (Exception e) {35e.printStackTrace();36}37}38}39EasyMock.createControl();40EasyMock.createControl();41EasyMock.createControl();42LastControl.getLastControl();43LastControl.getLastControl() is useful in some situations. For example, if you want to use EasyMock to mock a class that has a static method, you can use the following code:44public class ClassWithStaticMethod {45public static void staticMethod() {46}47}48public class ClassUnderTest {49public void method() {50ClassWithStaticMethod.staticMethod();51}52}53public class ClassUnderTestTest {54public void test() {55ClassUnderTest classUnderTest = new ClassUnderTest();56ClassWithStaticMethod mock = EasyMock.createMock(ClassWithStaticMethod.class);57EasyMock.expect(mock.staticMethod()).andReturn(null);58EasyMock.replay(mock);59classUnderTest.method();60EasyMock.verify(mock);61}62}63Note that this code will not work because EasyMock.createMock(Class) will return a mock object that is not the same as the mock object returned by EasyMock.createControl().createMock(Class). The following code will work:

Full Screen

Full Screen

LastControl

Using AI Code Generation

copy

Full Screen

1package org.easymock.internal;2import org.easymock.EasyMock;3import org.easymock.IAnswer;4import org.junit.Test;5public class LastControlTest {6 public void testLastControl() {7 final IAnswer<String> mock = EasyMock.createMock(IAnswer.class);8 EasyMock.expect(mock.answer()).andReturn("Hello World!");9 EasyMock.replay(mock);10 mock.answer();11 LastControl.reportMatcher(new IArgumentMatcher() {12 public void appendTo(StringBuffer buffer) {13 }14 public boolean matches(Object actual) {15 if (actual == mock) {16 return true;17 }18 return false;19 }20 });21 }22}23org.easymock.internal.LastControlTest > testLastControl() PASSED

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Easymock automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful