Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made some variable names more consistent with the other parts. #1635

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/org/junit/runner/Description.java
Expand Up @@ -222,11 +222,11 @@ public int testCount() {
if (isTest()) {
return 1;
}
int result = 0;
int conut = 0;
Copy link
Member

Choose a reason for hiding this comment

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

count?

Copy link
Author

Choose a reason for hiding this comment

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

Oops. That's a typo when I was manually copying the system output. Sorry.

The use of count was fairly common as seen in countTestCases() in junit/framework/TestSuite.java.

Copy link
Member

@kcooney kcooney Jan 3, 2021

Choose a reason for hiding this comment

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

@euske I was going to fix this myself, but I can't because your pull request was made on your master branch. Please fix this and send us a new pull. This should work:

$ git branch -f master 7065f37
$ put push -f master
$ git checkout -b consisent-variable-names ce0d7c7
$ git push --set-upstream origin consisent-variable-names 

Copy link
Member

Choose a reason for hiding this comment

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

You also may want to change your master branch main. You can follow the "What Your Teammates Have to Do" instructions at https://www.git-tower.com/learn/git/faq/git-rename-master-to-main/

I suggest fixing your master branch (following my previous instructions) first

for (Description child : fChildren) {
result += child.testCount();
conut += child.testCount();
}
return result;
return conut;
}

@Override
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
Expand Up @@ -164,9 +164,9 @@ private void validatePublicConstructor(List<Throwable> errors) {

protected void validateNoNonStaticInnerClass(List<Throwable> errors) {
if (getTestClass().isANonStaticInnerClass()) {
String gripe = "The inner class " + getTestClass().getName()
String message = "The inner class " + getTestClass().getName()
+ " is not static.";
errors.add(new Exception(gripe));
errors.add(new Exception(message));
}
}

Expand All @@ -186,8 +186,8 @@ protected void validateConstructor(List<Throwable> errors) {
*/
protected void validateOnlyOneConstructor(List<Throwable> errors) {
if (!hasOneConstructor()) {
String gripe = "Test class should have exactly one public constructor";
errors.add(new Exception(gripe));
String message = "Test class should have exactly one public constructor";
errors.add(new Exception(message));
}
}

Expand All @@ -199,8 +199,8 @@ protected void validateZeroArgConstructor(List<Throwable> errors) {
if (!getTestClass().isANonStaticInnerClass()
&& hasOneConstructor()
&& (getTestClass().getOnlyConstructor().getParameterTypes().length != 0)) {
String gripe = "Test class should have exactly one public zero-argument constructor";
errors.add(new Exception(gripe));
String message = "Test class should have exactly one public zero-argument constructor";
errors.add(new Exception(message));
}
}

Expand Down
48 changes: 24 additions & 24 deletions src/test/java/org/junit/rules/TemporaryFolderUsageTest.java
Expand Up @@ -208,43 +208,43 @@ public void deleteRemovesRootFolder() throws IOException {
public void newRandomFileIsCreatedUnderRootFolder() throws IOException {
tempFolder.create();

File f = tempFolder.newFile();
assertFileExists(f);
assertFileCreatedUnderRootFolder("Random file", f);
File file = tempFolder.newFile();
assertFileExists(file);
assertFileCreatedUnderRootFolder("Random file", file);
}

@Test
public void newNamedFileIsCreatedUnderRootFolder() throws IOException {
final String fileName = "SampleFile.txt";
tempFolder.create();

File f = tempFolder.newFile(fileName);
File file = tempFolder.newFile(fileName);

assertFileExists(f);
assertFileCreatedUnderRootFolder("Named file", f);
assertThat("file name", f.getName(), equalTo(fileName));
assertFileExists(file);
assertFileCreatedUnderRootFolder("Named file", file);
assertThat("file name", file.getName(), equalTo(fileName));
}

@Test
public void newRandomFolderIsCreatedUnderRootFolder() throws IOException {
tempFolder.create();

File f = tempFolder.newFolder();
assertFileIsDirectory(f);
assertFileCreatedUnderRootFolder("Random folder", f);
File file = tempFolder.newFolder();
assertFileIsDirectory(file);
assertFileCreatedUnderRootFolder("Random folder", file);
}

@Test
public void newNestedFoldersCreatedUnderRootFolder() throws IOException {
tempFolder.create();

File f = tempFolder.newFolder("top", "middle", "bottom");
assertFileIsDirectory(f);
assertParentFolderForFileIs(f, new File(tempFolder.getRoot(),
File file = tempFolder.newFolder("top", "middle", "bottom");
assertFileIsDirectory(file);
assertParentFolderForFileIs(file, new File(tempFolder.getRoot(),
"top/middle"));
assertParentFolderForFileIs(f.getParentFile(),
assertParentFolderForFileIs(file.getParentFile(),
new File(tempFolder.getRoot(), "top"));
assertFileCreatedUnderRootFolder("top", f.getParentFile()
assertFileCreatedUnderRootFolder("top", file.getParentFile()
.getParentFile());
}

Expand All @@ -269,15 +269,15 @@ private void assertFileDoesNotExist(File file) {
checkFileExists("exists", file, false);
}

private void checkFileExists(String msg, File file, boolean exists) {
private void checkFileExists(String message, File file, boolean exists) {
assertThat("File is null", file, is(notNullValue()));
assertThat("File '" + file.getAbsolutePath() + "' " + msg,
assertThat("File '" + file.getAbsolutePath() + "' " + message,
file.exists(), is(exists));
}

private void checkFileIsDirectory(String msg, File file, boolean isDirectory) {
private void checkFileIsDirectory(String message, File file, boolean isDirectory) {
assertThat("File is null", file, is(notNullValue()));
assertThat("File '" + file.getAbsolutePath() + "' " + msg,
assertThat("File '" + file.getAbsolutePath() + "' " + message,
file.isDirectory(), is(isDirectory));
}

Expand All @@ -291,12 +291,12 @@ private void assertFileIsDirectory(File file) {
checkFileIsDirectory("is not a directory", file, true);
}

private void assertFileCreatedUnderRootFolder(String msg, File f) {
assertParentFolderForFileIs(f, tempFolder.getRoot());
private void assertFileCreatedUnderRootFolder(String message, File file) {
assertParentFolderForFileIs(file, tempFolder.getRoot());
}

private void assertParentFolderForFileIs(File f, File parentFolder) {
assertThat("'" + f.getAbsolutePath() + "': not under root",
f.getParentFile(), is(parentFolder));
private void assertParentFolderForFileIs(File file, File parentFolder) {
assertThat("'" + file.getAbsolutePath() + "': not under root",
file.getParentFile(), is(parentFolder));
}
}