Skip to content

Instantly share code, notes, and snippets.

@RainerW
RainerW / StringUtilsTest.java
Created September 25, 2012 11:32 — forked from chbaranowski/StringUtilsTest.java
Compate Apache Common Lang StringUtils split performance with Google Guava Splitter split method.
import com.google.common.base.Splitter;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.util.StopWatch;
import java.util.Iterator;
@RainerW
RainerW / StringUtilsTest.java
Created September 25, 2012 10:00 — forked from chbaranowski/StringUtilsTest.java
Compate Apache Common Lang StringUtils split performance with Google Guava Splitter split method.
package bausteine;
import com.google.common.base.Splitter;
import org.apache.commons.lang.RandomStringUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.util.StopWatch;
import org.springframework.util.StringUtils;
package com.example.junit25;
import org.junit.Test;
import org.junit.internal.AssumptionViolatedException;
import org.junit.runner.RunWith;
@RunWith(JUnit4AssumtionRunner.class)
public class JUnit4AssumtionRunnerTest {
package com.example.junit25;
import org.junit.Ignore;
import org.junit.internal.AssumptionViolatedException;
import org.junit.internal.runners.model.EachTestNotifier;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
@RainerW
RainerW / ParentRunner.java
Created June 26, 2012 20:54
patch in Parentrunner.java
########### Original
/**
* Runs a {@link Statement} that represents a leaf (aka atomic) test.
*/
protected final void runLeaf(Statement statement, Description description,
RunNotifier notifier) {
EachTestNotifier eachNotifier= new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
try {
@RainerW
RainerW / Test4JUnitIssue_116_IgnoreRules.java
Created June 25, 2012 21:51
JUnit Ignore Rule sample
package com.example.junit116;
import java.util.ArrayList;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
@RainerW
RainerW / gist:2358589
Created April 11, 2012 10:44
JUnit MethodRule / TestRule solution?
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.runner.Description;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
// ************ draft for new rule interface ************
@RainerW
RainerW / gist:1309806
Created October 24, 2011 18:52
junit#351
package rules.impl;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.MethodRule;
import org.junit.rules.TestRule;
package com.seitenbau.demo.systemtest;
import static com.seitenbau.assertions.Assertions.assertThat;
import javax.inject.Inject;
import org.junit.Test;
interface WorkDelegate<T> {
void doWork(T target);
}
@RainerW
RainerW / csvconvertor.groovy
Created June 3, 2011 17:38 — forked from chbaranowski/csvconvertor.groovy
Convert a CSV file into another CSV format.
public class CsvSplit
{
public static void main(String[] args) throws Exception
{
FileWriter out = new FileWriter("output.csv");
BufferedReader in = new BufferedReader(new FileReader("input.csv"));
String line;
while ((line = in.readLine()) != null)
{
String[] fields = line.split(";");