Skip to content

Instantly share code, notes, and snippets.

@josefbetancourt
josefbetancourt / Vsdf.java
Last active October 13, 2015 05:57
Very simple data file in Java source with embedded JUnit test. Presented in "Simple Java Data File" blog post.
/** Vsdf.java */
package com.octodecillion.vsdf;
import static com.octodecillion.vsdf.Vsdf.EventType.END;
import static org.hamcrest.core.DescribedAs.describedAs;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@josefbetancourt
josefbetancourt / FindFile.groovy
Created July 9, 2012 11:52
Use Groovy to find path of a file in a directory tree
import groovy.transform.TypeChecked
/**
* search file according to its name in directory and subdirectories
*/
@TypeChecked
class FileFind {
String basePath; // for unit testing
@josefbetancourt
josefbetancourt / FubarClassExample.java
Created November 30, 2011 09:19
Sample class for illustrating unit testing
public class Fubar {
private boolean launch = true;
public void getLaunch(){
return this.launch;
}
public void setLaunch(boolean launch){
/* this.launch = launch; */ // broken!
}