~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to results/plugins/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/tests/StringBuilderTest.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************************
2
 
 * Copyright (c) 2008 Wind River Systems, Inc. and others.
3
 
 * All rights reserved. This program and the accompanying materials
4
 
 * are made available under the terms of the Eclipse Public License v1.0
5
 
 * which accompanies this distribution, and is available at
6
 
 * http://www.eclipse.org/legal/epl-v10.html
7
 
 *
8
 
 * Contributors:
9
 
 *    Markus Schorn - initial API and implementation
10
 
 *******************************************************************************/ 
11
 
 
12
 
package org.eclipse.cdt.core.internal.tests;
13
 
 
14
 
import java.lang.reflect.Method;
15
 
 
16
 
import junit.framework.Test;
17
 
import junit.framework.TestCase;
18
 
import junit.framework.TestSuite;
19
 
 
20
 
public class StringBuilderTest extends TestCase {
21
 
    public static Test suite() {
22
 
        return new TestSuite(StringBuilderTest.class);
23
 
    }
24
 
 
25
 
    public void testSafe() {
26
 
        StringBuilder b1= new StringBuilder();
27
 
        StringBuilder b2= new StringBuilder();
28
 
        b1.append("a");
29
 
        b2.append("b");
30
 
        CharSequence cs= b2;
31
 
        b1.append(cs);
32
 
        assertEquals("ab", b1.toString());
33
 
    }
34
 
    
35
 
    public void testBug220158() {
36
 
        StringBuilder b1= new StringBuilder();
37
 
        StringBuilder b2= new StringBuilder();
38
 
        b1.append("a");
39
 
        b2.append("b");
40
 
        b1.append(b2);
41
 
        assertEquals("ab", b1.toString());
42
 
    }
43
 
    
44
 
    public void testStringBuilderMethods() throws Exception {
45
 
        Class clazz= StringBuilder.class;
46
 
                Method method= clazz.getMethod("append", CharSequence.class);  
47
 
                assertNotNull(method);
48
 
        try {
49
 
                method= clazz.getMethod("append", StringBuilder.class);
50
 
                fail();
51
 
        }
52
 
        catch (NoSuchMethodException m) {
53
 
                // ok
54
 
        }
55
 
    }
56
 
}