This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spock.lang.Specification | |
class PartialMockingAbstractClasses extends Specification { | |
def "Square with stubbed getLength()"() { | |
given: | |
Square square = Spy() { | |
2 * getLength() >> 3 | |
} | |
when: | |
def area = square.area |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ISquare { | |
double getLength(); | |
default double getArea() { | |
return getLength() * getLength(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Range<T extends Number> implements Comparable<Range<T>> { | |
private final T minVal; | |
private final T maxVal; | |
public Range(T minVal, T maxVal) { | |
this.minVal = minVal; | |
this.maxVal = maxVal; | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package github.gist.testfx | |
import javafx.scene.Parent | |
import javafx.scene.Scene | |
import javafx.stage.Stage | |
import org.testfx.framework.junit.ApplicationTest | |
import spock.lang.Specification | |
abstract class GuiSpecification extends Specification { | |
ApplicationTest fx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class RegularPoly { | |
public double getLength() { | |
return Math.abs(System.identityHashCode(this)) % 100; | |
} | |
public abstract double getArea(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InMemoryProtocol { | |
static final String PROTOCOL_NAME = 'inmemory' | |
static final Map inMemoryMap = [:] | |
static int inMemoryIndex = 0 | |
static { | |
URL.URLStreamHandlerFactory = new URLStreamHandlerFactory() { | |
@Override URLStreamHandler createURLStreamHandler(String protocol) { | |
(protocol == PROTOCOL_NAME) ? new URLStreamHandler() { | |
@Override protected URLConnection openConnection(URL url) throws IOException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.scene.effect.BoxBlur; | |
import javafx.scene.effect.Effect; | |
import javafx.scene.effect.Shadow; | |
import javafx.scene.paint.Color; | |
import org.beryx.streamplify.product.CartesianProduct; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.function.BiConsumer; | |
import java.util.stream.Collectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.io.IOUtils; | |
import org.kohsuke.github.*; | |
import java.net.URL; | |
public class MultiCommit { | |
public static void main(String[] args) throws Exception { | |
String userId = "your-user-id"; | |
String password = "your-password"; | |
String repoName = "your-repo-name"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.beryx.textio.demo; | |
import org.beryx.textio.TextIoFactory; | |
import org.beryx.textio.TextTerminal; | |
import java.util.Locale; | |
import java.util.Random; | |
public class TestFlickering { | |
private static final Random rnd = new Random(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hsqldb.Server; | |
import org.hsqldb.persist.HsqlProperties; | |
import org.jooq.*; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import static org.jooq.impl.DSL.*; | |
public class JooqUpsertV1 { |
OlderNewer