Skip to content

Instantly share code, notes, and snippets.

@mid0111
mid0111 / Foo.java
Created February 7, 2014 08:44
Junit spy static method.
public class Foo {
public static String testMethod() {
return "foo";
}
}
@mid0111
mid0111 / FooTest.java
Created February 4, 2014 07:56
JUnit4のData Driven Test
@RunWith(Enclosed.class)
@Category({Unit.class })
public class FooTest {
/**
* テスト用Fixture。
*/
static class Fixture {
String testComment;
/**
@mid0111
mid0111 / QueryMapFactoryTest.java
Created January 31, 2014 03:46
assert to nested Map
import org.codehaus.jackson.map.ObjectMapper;
public class QueryMapFactoryTest {
@Test
public void クエリを作成できること() {
Map<String, Object> actual = QueryMapFactoryTest.getQuery();
@mid0111
mid0111 / app.js
Last active December 16, 2015 23:49
integration tests for express with mocha.
var express = require('express');
// ...
var app = module.exports = express();
// ...
@mid0111
mid0111 / IsDate.java
Last active October 10, 2015 18:58
Custom Date Matcher for JUnit4
package sample;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;