mirror of
https://github.com/Brandon-Rozek/website.git
synced 2025-10-10 06:51:13 +00:00
New Posts
This commit is contained in:
parent
3996e177f8
commit
7b0138265d
3 changed files with 148 additions and 0 deletions
34
content/blog/junit-script.md
Normal file
34
content/blog/junit-script.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: "JUnit Script"
|
||||
date: 2022-02-26T20:02:53-05:00
|
||||
draft: false
|
||||
tags: ["Java"]
|
||||
math: false
|
||||
---
|
||||
|
||||
Running a JUnit test on the terminal is a little annoying. Here is a quick script to make it easier, make it executable and drop it in [`~/.local/bin`](/blog/customexec/) for easy use.
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
JUNIT_PATH="/usr/share/java/junit4.jar"
|
||||
|
||||
show_usage() {
|
||||
echo "Usage: junit [class file path]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check argument count
|
||||
if [ "$#" -ne 1 ]; then
|
||||
show_usage
|
||||
fi
|
||||
|
||||
java -cp "$JUNIT_PATH":. org.junit.runner.JUnitCore "$1"
|
||||
|
||||
```
|
||||
|
||||
Replacing `JUNIT_PATH` with the location of the `junit4.jar` on your system.
|
Loading…
Add table
Add a link
Reference in a new issue