How to use method of org.jmock.test.unit.support.AssertThat class

Best Jmock-library code snippet using org.jmock.test.unit.support.AssertThat.

Run Jmock-library automation tests on LambdaTest cloud grid

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

copy
1/*  Copyright (c) 2000-2004 jMock.org
2 */
3package org.jmock.test.unit.support;
4
5import junit.framework.AssertionFailedError;
6
7
8public class AssertThat extends junit.framework.Assert
9{
10    public static void arraysAreEqual( String description,
11                                     Object[] expectedArray,
12                                     Object[] actualArray ) {
13        assertEquals(description + " (different lengths)",
14                     expectedArray.length,
15                     actualArray.length);
16        
17        for (int i = 0; i < expectedArray.length; i++) {
18            assertEquals(description + " (element " + i + ")",
19                         expectedArray[i],
20                         actualArray[i]);
21        }
22    }
23
24    public static void stringExcludes( String description,
25                                       String excludeString,
26                                       String targetString ) {
27        assertTrue(description
28                   + "\nExclude String: "
29                   + excludeString
30                   + "\n Target String: "
31                   + targetString,
32                   targetString.indexOf(excludeString) == -1);
33    }
34
35    public static void stringIncludes( String description,
36                                       String includeString,
37                                       String targetString ) {
38        assertTrue(description
39                   + "\nInclude String: "
40                   + includeString
41                   + "\n Target String: "
42                   + targetString,
43                   targetString.indexOf(includeString) != -1);
44    }
45
46    public static void stringStartsWith( String description,
47                                         String startString,
48                                         String targetString ) {
49        assertTrue(description
50                   + "\n Start String: "
51                   + startString
52                   + "\nTarget String: "
53                   + targetString,
54                   targetString.startsWith(startString));
55    }
56
57//    static protected void failNotEquals( String message,
58//                                         Object expected,
59//                                         Object actual ) {
60//        String formatted = "";
61//        if (message != null) {
62//            formatted = message + " ";
63//        }
64//        fail(formatted + "\nExpected:<" + expected + ">\nReceived:<" + actual + ">");
65//    }
66
67    public static void fails( String message, Runnable runnable ) {
68        try {
69            runnable.run();
70        }
71        catch (AssertionFailedError expected) {
72            return;
73        }
74        fail(message);
75    }
76}
77
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger code on LambdaTest Cloud Grid

Execute automation tests with on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)