// Copyright 2015 ThoughtWorks, Inc.
// This file is part of Gauge-Java.
// This program is free software.
//
// It is dual-licensed under:
// 1) the GNU General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version;
// or
// 2) the Eclipse Public License v1.0.
//
// You can redistribute it and/or modify it under the terms of either license.
// We would then provide copied of each license in a separate .txt file with the name of the license as the title of the file.
package com.thoughtworks.gauge.refactor;
import junit.framework.TestCase;
public class UtilTest extends TestCase {
public void testGetCamelCase() throws Exception {
assertEquals("helloWorld", Util.convertToCamelCase("Hello world"));
assertEquals("gaugeJavaProject", Util.convertToCamelCase("gauge Java project "));
assertEquals("123Go", Util.convertToCamelCase("12 3 go"));
assertEquals("allhailTheKing", Util.convertToCamelCase(" AllHaiL tHe king"));
}
public void testGetValidJavaIdentifier() {
assertEquals("", Util.getValidJavaIdentifier("%"));
assertEquals("", Util.getValidJavaIdentifier("^%@!*^&|()"));
assertEquals("", Util.getValidJavaIdentifier("|"));
assertEquals("hello", Util.getValidJavaIdentifier("hello"));
assertEquals("hello", Util.getValidJavaIdentifier("hello&"));
assertEquals("_hello", Util.getValidJavaIdentifier("_hello&"));
assertEquals("_hello", Util.getValidJavaIdentifier("_hello&("));
assertEquals("2hello", Util.getValidJavaIdentifier("2hello&("));
assertEquals("ƒ", Util.getValidJavaIdentifier("˚¬∆˙©ƒ∂"));
}
}