Skip to content

Instantly share code, notes, and snippets.

@flying3615
Created October 19, 2016 08:31
Show Gist options
  • Save flying3615/af265cb53e8aae96d51a18a328ca3aa1 to your computer and use it in GitHub Desktop.
Save flying3615/af265cb53e8aae96d51a18a328ca3aa1 to your computer and use it in GitHub Desktop.
create junit test for Timing code
package Java_FP.Timing;
import java.util.concurrent.atomic.AtomicReference;
/**
* Created by liuyufei on 19/10/16.
*/
public class TimingTest {
@org.junit.Test
public void testTimed() throws Exception {
final String description = "Supply carrot";
AtomicReference<String> output = new AtomicReference<>();
Timing.timed(description,output::set,()->"carrot");
assert(output.get().contains(description));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment