Skip to content

BAEL-1328#3099

Merged
KevinGilmore merged 7 commits intoeugenp:masterfrom
andrethiago:master
Dec 6, 2017
Merged

BAEL-1328#3099
KevinGilmore merged 7 commits intoeugenp:masterfrom
andrethiago:master

Conversation

@andrethiago
Copy link
Copy Markdown
Contributor

Code for mini-article about how to invert array in Java.

@andrethiago
Copy link
Copy Markdown
Contributor Author

Correcting indentation and added implementation in Commons Lang and Guava.

Copy link
Copy Markdown
Contributor Author

@andrethiago andrethiago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correcting indentation and added implementation with Commons Lang and Guava.

Copy link
Copy Markdown
Contributor

@KevinGilmore KevinGilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use AssertJ.

ArrayInverter inverter = new ArrayInverter();
inverter.invertUsingFor(fruits);

assertArrayEquals(new String[] { "oranges", "pineapples", "guavas", "bananas", "tomatoes", "apples" }, fruits);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use AssertJ to do the assertions rather than the JUnit Assert class. Also, you could just create a field or constant to hold the inverted array, and use it in the tests.

@@ -0,0 +1,48 @@
package com.baeldung.array;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to ArrayInverterUnitTest

Copy link
Copy Markdown
Contributor Author

@andrethiago andrethiago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested changes made.

@KevinGilmore KevinGilmore merged commit 5477f80 into eugenp:master Dec 6, 2017
tarangbhalodia pushed a commit to tarangbhalodia/tutorials that referenced this pull request Jan 2, 2018
* BAEL-1328 How to Invert an Array in Java

* Removing code from evaluation article.

* BAEL-1328
Adjusting spaces and implement inversion with commons lang3 and guava.

* BAEL-1328 Renaming unit test class; using AssertJ.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants