Skip to content

Instantly share code, notes, and snippets.

View seanjreilly's full-sized avatar
😈
Doing questionable things with computers

Sean Reilly seanjreilly

😈
Doing questionable things with computers
  • Gousto
  • London, UK
View GitHub Profile
@seanjreilly
seanjreilly / junit5.xml
Last active February 19, 2024 12:18
An IntelliJ live template for JUnit5 unit tests in Java.
<templateSet group="JUnit5">
<template name="test" value="@org.junit.jupiter.api.Test&#10;@org.junit.jupiter.api.DisplayName(&quot;$name$&quot;)&#10;void $method$() throws Exception {&#10; $END$&#10;}" description="JUnit 5 test" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="name" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="method" expression="camelCase(name)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
</templateSet>
@seanjreilly
seanjreilly / Foo.java
Created July 1, 2015 10:18
Pattern for ensuring that an optional collection passed into an argument is immutable
import java.util.Optional;
import java.util.LinkedHashSet;
import java,util.Collections;
public final class Foo {
private final Optional<Set<String>> args;
public Foo(Optional<Set<String>> args) {
this.args = args.map(LinkedHashSet::new).map(Collections::unmodifiableSet);
@seanjreilly
seanjreilly / gist:086968ab04fbb339b562
Created August 8, 2014 19:08
Gradle error message with Java 1.8 and -parameters
* What went wrong:
Execution failed for task ':test'.
> failed to read class file /Users/sreilly/Projects/gradle-parameters-bug/build/classes/test/TheTest.class
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':test'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
@seanjreilly
seanjreilly / gist:ea406fad59300c422c16
Created July 8, 2014 14:28
stack trace trying to use the mutability detector on a class with a field of java.time.Instant
org.mutabilitydetector.checkers.MutabilityAnalysisException:
An unhandled error occurred. Please read message at end of this output.
Class being analysed: com.equalexperts.logging.LogicalLogRecord
Checker that failed: MutableTypeToFieldChecker
Classes analysed so far:
An unhandled error occurred. This is probably my fault, not yours, and I am sorry.
I'd love to get an opportunity to fix this, please report as an issue at:
https://github.com/MutabilityDetector/MutabilityDetector/issues/

Keybase proof

I hereby claim:

  • I am seanjreilly on github.
  • I am seanjreilly (https://keybase.io/seanjreilly) on keybase.
  • I have a public key whose fingerprint is D37F FF5A 6E53 A7FC 6D34 A756 22FD D581 1EDE 915E

To claim this, I am signing this object:

@seanjreilly
seanjreilly / gist:8630838
Created January 26, 2014 10:08
The boiler plate virtual box config section for a Vagrantfile
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider :virtualbox do |vb|
# Don't boot with headless mode
#vb.gui = false
# Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
@seanjreilly
seanjreilly / gist:6183722
Created August 8, 2013 11:04
Stack trace trying to use the rpm plugin with gradle 1.7
FAILURE: Build failed with an exception.
* Where:
Script '/Users/sreilly/Projects/XXX/build.gradle' line: XXX
* What went wrong:
A problem occurred evaluating script.
> Could not create task of type 'Rpm'.
* Try: