-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
# ApprovalTests.java.StarterProject | ||
# Refactoring Early Returns | ||
|
||
[![Build Status](../../workflows/build/badge.svg?branch=main)](../../actions?query=build%3Amain) | ||
|
||
|
||
This is a starter project for: | ||
2 Practice Exercises for Refactoring Early Returns in Java. | ||
|
||
* ApprovalTests in java - see [ApprovalTests.java](https://github.com/approvals/ApprovalTests.java) | ||
* Junit | ||
* Maven | ||
|
||
Works on Mac, Linux and Windows. | ||
|
||
Feel free to copy and go... | ||
|
||
## Starting Point | ||
|
||
The tests in [SampleTests](https://github.com/approvals/ApprovalTests.java.StarterProject/blob/master/src/test/java/org/samples/SampleTests.java) should pass, and then you should delete/modify as needed to get started. | ||
|
||
|
||
Notes: | ||
|
||
* For more information, see the [ApprovalTests.java User Guide](https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/README.md#top) | ||
* You will need a Diff tool. | ||
* Suggestions: | ||
* Mac: [DiffMerge](https://sourcegear.com/diffmerge/) | ||
* Windows: [WinMerge](winmerge.org/) | ||
* Linux: [meld](http://meldmerge.org/) | ||
# Steps for refactoring | ||
1. Add nullable return | ||
1. set value | ||
1. if != null return | ||
1. move if | ||
1. add else | ||
1. invert if | ||
1. repeat until all returns are at the end | ||
1. clean up | ||
|
||
|