Skip to content

Instantly share code, notes, and snippets.

View sormuras's full-sized avatar
Testing...

Christian Stein sormuras

Testing...
View GitHub Profile
@sormuras
sormuras / AppendChar.java
Created June 27, 2013 07:47
Commander - Interfacing Prevayler
class AppendChar implements Transaction<Appendable> {
private final char c;
public AppendChar(char c) {
this.c = c;
}
public void executeOn(Appendable prevalentSystem, Date executionTime) {
prevalentSystem.append(c);
}
}
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.WeakHashMap;
@sormuras
sormuras / PrevaylerEight.java
Last active August 29, 2015 14:05
Not thread-safe Prevayler implementation
package org.prevayler.contrib.eight;
import static java.lang.String.format;
import static java.nio.file.Files.createLink;
import static java.nio.file.Files.deleteIfExists;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
Windows 8.1 (64)
Intel Core i7-3770K 3.9 Ghz
8 GB RAM
Samsung SSD 840 EVO 120 GB
java.version=1.8.0_20
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
=============================================================
Windows 8.1 (64)
Intel Core i7-3770K 3.9 Ghz
8 GB RAM
Samsung SSD 840 EVO 120 GB
java.version=1.8.0_20
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
=============================================================
Prevayler vs JDBC Scalability Tests
package databench.prevayler;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.prevayler.Prevayler;
import org.prevayler.contrib.p8.P8;
import org.prevayler.contrib.p8.SynchronizedPrevayler;
@sormuras
sormuras / MemberRef.java
Created October 15, 2015 21:36
MemberRef tests and usage examples
package com.squareup.javapoet;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
import javax.lang.model.element.Element;
+-- JUnit Vintage
| +-- example.JUnit4Tests
| | +-- standardJUnit4Test (1 ms)
+-- JUnit Jupiter
| +-- AssertionsDemo
| | +-- timeoutExceeded() (109 ms)
| | +-- exceptionTesting() (1 ms)
| | +-- timeoutNotExceeded() (0 ms)
| | +-- standardAssertions() (1 ms)
| | +-- groupedAssertions() (1 ms)
@sormuras
sormuras / Lion24.java
Last active December 9, 2016 08:07
Lion24 Adventskalender Checker
package de.sormuras.advent;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
@sormuras
sormuras / ConsoleDetailsTests.java
Last active March 3, 2017 22:49
JUnit Platform Console Details Tests
/*
* Copyright 2015-2017 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/