How to use method of org.easymock.tests.ArgumentToStringTest class

Best Easymock code snippet using org.easymock.tests.ArgumentToStringTest.

Run Easymock automation tests on LambdaTest cloud grid

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

copy
1/**
2 * Copyright 2001-2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.easymock.tests;
17
18import static org.junit.Assert.*;
19
20import org.easymock.internal.ArgumentToString;
21import org.junit.Before;
22import org.junit.Test;
23
24/**
25 * @author Henri Tremblay
26 */
27public class ArgumentToStringTest {
28
29    private StringBuffer buffer;
30
31    @Before
32    public void setUp() {
33        buffer = new StringBuffer();
34    }
35
36    @Test
37    public void testAppendArgument_null() {
38        assertString("null", null);
39    }
40
41    @Test
42    public void testAppendArgument_String() {
43        assertString("\"hello\"", "hello");
44    }
45
46    @Test
47    public void testAppendArgument_Character() {
48        assertString("'c'", Character.valueOf('c'));
49    }
50
51    @Test
52    public void testAppendArgument_Array() {
53        assertString("[\"a\", \"b\"]", new String[] { "a", "b" });
54    }
55
56    @Test
57    public void testAppendArgument_Full() {
58        assertString("[3, 4, [\"a\", \"b\"], null]", new Object[] { 3, 4, new String[] { "a", "b" }, null });
59    }
60
61    private void assertString(final String expected, final Object actual) {
62        ArgumentToString.appendArgument(actual, buffer);
63        assertEquals(expected, buffer.toString());
64    }
65
66    @Test
67    public void testArgumentToString() {
68        final String actual = ArgumentToString.argumentToString(Boolean.TRUE);
69        assertEquals(Boolean.TRUE.toString(), actual);
70    }
71
72    @Test
73    public void testArgumentsToString() {
74        final String actual = ArgumentToString.argumentsToString(Boolean.TRUE, Boolean.FALSE);
75        assertEquals("true, false", actual);
76    }
77
78    @Test
79    public void testArgumentsToString_null() {
80        final String actual = ArgumentToString.argumentsToString((Object[]) null);
81        assertEquals("", actual);
82    }
83}
84
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)