author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Sat, 15 Dec 2012 08:17:45 +0100 | |
changeset 322 | 3884815c0629 |
parent 321 | 1848c77df886 |
child 326 | 23b4a344fe02 |
permissions | -rw-r--r-- |
jaroslav@296 | 1 |
/** |
jaroslav@296 | 2 |
* Back 2 Browser Bytecode Translator |
jaroslav@296 | 3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@296 | 4 |
* |
jaroslav@296 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@296 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@296 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@296 | 8 |
* |
jaroslav@296 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@296 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@296 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@296 | 12 |
* GNU General Public License for more details. |
jaroslav@296 | 13 |
* |
jaroslav@296 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@296 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@296 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@296 | 17 |
*/ |
jaroslav@296 | 18 |
package org.apidesign.vm4brwsr.tck; |
jaroslav@296 | 19 |
|
jaroslav@322 | 20 |
import java.lang.reflect.Method; |
jaroslav@296 | 21 |
import org.apidesign.vm4brwsr.Compare; |
jaroslav@296 | 22 |
import org.apidesign.vm4brwsr.CompareVMs; |
jaroslav@296 | 23 |
import org.testng.annotations.Factory; |
jaroslav@296 | 24 |
|
jaroslav@296 | 25 |
/** |
jaroslav@296 | 26 |
* |
jaroslav@296 | 27 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@296 | 28 |
*/ |
jaroslav@296 | 29 |
public class CompareStringsTest { |
jaroslav@296 | 30 |
@Compare public String deleteLastTwoCharacters() { |
jaroslav@296 | 31 |
StringBuilder sb = new StringBuilder(); |
jaroslav@296 | 32 |
sb.append("453.0"); |
jaroslav@296 | 33 |
if (sb.toString().endsWith(".0")) { |
jaroslav@296 | 34 |
final int l = sb.length(); |
jaroslav@296 | 35 |
sb.delete(l - 2, l); |
jaroslav@296 | 36 |
} |
jaroslav@296 | 37 |
return sb.toString().toString(); |
jaroslav@296 | 38 |
} |
jaroslav@296 | 39 |
|
jaroslav@321 | 40 |
@Compare public String nameOfStringClass() throws Exception { |
jaroslav@321 | 41 |
return Class.forName("java.lang.String").getName(); |
jaroslav@321 | 42 |
} |
jaroslav@322 | 43 |
@Compare public String nameOfArrayClass() throws Exception { |
jaroslav@322 | 44 |
return Class.forName("org.apidesign.vm4brwsr.Array").getName(); |
jaroslav@322 | 45 |
} |
jaroslav@322 | 46 |
|
jaroslav@296 | 47 |
@Factory |
jaroslav@296 | 48 |
public static Object[] create() { |
jaroslav@296 | 49 |
return CompareVMs.create(CompareStringsTest.class); |
jaroslav@296 | 50 |
} |
jaroslav@296 | 51 |
} |