Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Forsythe DarrenForsythe

View GitHub Profile
View junit-5-migrator.sh
#!/bin/sh
FILE=pom.xml
if [[ -f "$FILE" ]]; then
echo "$FILE found. Running Junit conversion. Note this is not a complete movement script. You will need\
to do some manual tweaks to your code base"
#Move to the new Test Annotation
echo "Moving to Jupiter Test Annotation"
git grep -l 'org.junit.Test' | xargs sed -i '' -e 's/org.junit.Test/org.junit.jupiter.api.Test/g'
#Move to new Before Annotation
echo "Moving Before to BeforeEach"
View ControllerTest.java
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MyApp.class)
public class MyRestControllerTest {
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
@DarrenForsythe
DarrenForsythe / ClassLoaderLeakExample.java
Created Sep 27, 2017 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
View ClassLoaderLeakExample.java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@DarrenForsythe
DarrenForsythe / ClassLoaderLeakExample.java
Created Sep 27, 2017 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
View ClassLoaderLeakExample.java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,