How to use RetroNamingScheme class of org.jmock.lib package

Best Jmock-library code snippet using org.jmock.lib.RetroNamingScheme

Run Jmock-library automation tests on LambdaTest cloud grid

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

copy
1package org.jmock.test.unit.lib;
2
3import junit.framework.TestCase;
4
5import org.jmock.api.MockObjectNamingScheme;
6import org.jmock.lib.RetroNamingScheme;
7import org.jmock.test.unit.support.DummyInterface;
8
9public class RetroNamingSchemeTests extends TestCase {
10    public void testNamesMocksByLowerCasingFirstCharacterOfTypeName() {
11        MockObjectNamingScheme namingScheme = RetroNamingScheme.INSTANCE;
12        
13        assertEquals("mockRunnable", namingScheme.defaultNameFor(Runnable.class));
14        assertEquals("mockDummyInterface", namingScheme.defaultNameFor(DummyInterface.class));
15    }
16}
17
Full Screen
copy
1package org.jmock.lib;
2
3import org.jmock.api.MockObjectNamingScheme;
4
5/**
6 * A naming scheme in which the implicit name for a mock object is
7 * the mocked type's name prepend with "mock".
8 * 
9 * E.g. A mock object of type HelloWorld would be called "mockHelloWorld".
10 * 
11 * This was the naming scheme used at Connextra and in many early examples
12 * of TDD with mock objects.
13 * 
14 * @author npryce
15 *
16 */
17public class RetroNamingScheme implements MockObjectNamingScheme {
18    public static final RetroNamingScheme INSTANCE = new RetroNamingScheme();
19    
20    public String defaultNameFor(Class<?> typeToMock) {
21        return "mock" + typeToMock.getSimpleName();
22    }
23}
24
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

...Most popular Stackoverflow questions on RetroNamingScheme

    No relevant questions found for this class 😞

Most used methods in RetroNamingScheme

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

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)