Skip to content

Instantly share code, notes, and snippets.

View tedyoung's full-sized avatar

Ted M. Young tedyoung

View GitHub Profile
@tedyoung
tedyoung / surround.xml
Created July 6, 2022 15:39
My favorite IntelliJ IDEA + AssertJ Surround templates. Add these to your "surround.xml" file in your "templates" directory.
<templateSet group="surround">
<template name="attb" value="org.assertj.core.api.Assertions.assertThatThrownBy(() -&gt; {$SELECTION$}).isInstanceOf($EXCEPTION$);$END$" shortcut="NONE" description="Surround with assertThatThrownBy" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="EXCEPTION" expression="descendantClassesEnum(&quot;Exception&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
</context>
</template>
<template name="ast" value="assertThat({$SELECTION$})&#10; .$END$" shortcut="NONE" description="Surround with assertThat" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_CODE" value="true" />
@tedyoung
tedyoung / justfile for tdd using Maven Daemon (mvnd)
Last active July 25, 2022 19:56 — forked from gregorriegler/justfile for tdd and tcr
justfile for continuous testing and tcr
# justfile (see https://just.systems/man/en/ for docs on "just")
goal +MESSAGE:
git pull --rebase
git commit --allow-empty -m "Goal: {{MESSAGE}}"
git push
commit:
@git add .
-@git commit -am "wip"
package dev.ted.junit;
import org.junit.jupiter.api.DisplayNameGenerator;
import java.lang.reflect.Method;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReplaceCamelCase extends DisplayNameGenerator.Simple {
private final static Pattern CAMEL_CASE_BOUNDARY = Pattern.compile("(([A-Z]?[a-z]+)|([A-Z]))");
## Postfix templates for use with Custom Postfix Templates plugin for IntelliJ IDEA
# combines .new with .var
.nv : new var
CLASS → $expr$ $var:suggestVariableName()$ = new $expr$();$END$