Skip to content

Commit

Permalink
Merged
Browse files Browse the repository at this point in the history
  • Loading branch information
minborg committed Jan 20, 2015
2 parents bc4f724 + 21a7a07 commit c532e6e
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Expand Up @@ -64,6 +64,13 @@
<artifactId>codemodel-project</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>


</project>
62 changes: 62 additions & 0 deletions src/main/java/com/speedment/util/$.java
@@ -0,0 +1,62 @@
/**
*
* Copyright (c) 2006-2015, Speedment, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.speedment.util;

/**
*
* @author Duncan
*/
public class $ implements CharSequence {

private final StringBuilder str;

public $() {
this("");
}

public $(CharSequence... objects) {
str = new StringBuilder();
$(objects);
}

public final $ $(CharSequence... objects) {
for (CharSequence object : objects) {
str.append(object);
}
return this;
}

@Override
public int length() {
return str.length();
}

@Override
public char charAt(int index) {
return str.charAt(index);
}

@Override
public CharSequence subSequence(int start, int end) {
return str.subSequence(start, end);
}

@Override
public String toString() {
return str.toString();
}
}
59 changes: 59 additions & 0 deletions src/test/java/com/speedment/util/TestDollar.java
@@ -0,0 +1,59 @@
/**
*
* Copyright (c) 2006-2015, Speedment, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.speedment.util;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
*
* @author Duncan
*/
public class TestDollar {

private $ instance;

public TestDollar() {
}

@BeforeClass
public static void setUpClass() {
}

@AfterClass
public static void tearDownClass() {
}

@Before
public void setUp() {
instance = new $();
}

@After
public void tearDown() {
}

@Test
public void testConcatenation() {
instance.$("qwerty").$("asdfg", "zxcvb");
assertEquals("qwertyasdfgzxcvb", instance.toString());
}
}

0 comments on commit c532e6e

Please sign in to comment.