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

Enable Spotless #637

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
457 changes: 227 additions & 230 deletions pom.xml

Large diffs are not rendered by default.

258 changes: 155 additions & 103 deletions src/main/java/hudson/tasks/junit/CaseResult.java

Large diffs are not rendered by default.

91 changes: 48 additions & 43 deletions src/main/java/hudson/tasks/junit/ClassResult.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* The MIT License
*
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer, id:cactusman, Tom Huybrechts, Yahoo!, Inc.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -45,10 +45,10 @@

private final Set<CaseResult> cases = new TreeSet<CaseResult>();

private int passCount,failCount,skipCount;
private float duration;
private int passCount, failCount, skipCount;

private float duration;

private long startTime;

private final PackageResult parent;
Expand All @@ -61,7 +61,7 @@

@Override
public Run<?, ?> getRun() {
return parent==null ? null: parent.getRun();
return parent == null ? null : parent.getRun();
}

@Override
Expand All @@ -71,12 +71,16 @@

@Override
public ClassResult getPreviousResult() {
if(parent==null) return null;
if (parent == null) {

Check warning on line 74 in src/main/java/hudson/tasks/junit/ClassResult.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 74 is only partially covered, one branch is missing
return null;

Check warning on line 75 in src/main/java/hudson/tasks/junit/ClassResult.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 75 is not covered by tests
}
TestResult pr = parent.getPreviousResult();
if(pr==null) return null;
if(pr instanceof PackageResult) {
return ((PackageResult)pr).getClassResult(getName());
}
if (pr == null) {

Check warning on line 78 in src/main/java/hudson/tasks/junit/ClassResult.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 78 is only partially covered, one branch is missing
return null;
}
if (pr instanceof PackageResult) {
return ((PackageResult) pr).getClassResult(getName());
}
return null;
}

Expand All @@ -87,8 +91,8 @@
int base = id.indexOf(myID);
if (base > 0) {
int caseNameStart = base + myID.length() + 1;
if (id.length() > caseNameStart) {
caseName = id.substring(caseNameStart);
if (id.length() > caseNameStart) {
caseName = id.substring(caseNameStart);
}
}
return getCaseResult(caseName);
Expand All @@ -109,12 +113,15 @@
return "case";
}

@Exported(visibility=999)
@Exported(visibility = 999)
@Override
public String getName() {
int idx = className.lastIndexOf('.');
if(idx<0) return className;
else return className.substring(idx+1);
if (idx < 0) {
return className;
} else {
return className.substring(idx + 1);
}
}

public @Override synchronized String getSafeName() {
Expand All @@ -123,27 +130,27 @@
}
return safeName = uniquifyName(parent.getChildren(), safe(getName()));
}

public CaseResult getCaseResult(String name) {
for (CaseResult c : cases) {
if(c.getSafeName().equals(name))
if (c.getSafeName().equals(name)) {
return c;
}
}
return null;
}

@Override
public Object getDynamic(String name, StaplerRequest req, StaplerResponse rsp) {
CaseResult c = getCaseResult(name);
if (c != null) {
if (c != null) {
return c;
} else {
} else {
return super.getDynamic(name, req, rsp);
}
}
}


@Exported(name="child")
@Exported(name = "child")
@Override
public Collection<CaseResult> getChildren() {
return cases;
Expand All @@ -154,16 +161,16 @@
return (cases != null) && (cases.size() > 0);
}

// TODO: wait for stapler 1.60 @Exported

Check warning on line 164 in src/main/java/hudson/tasks/junit/ClassResult.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: wait for stapler 1.60 @exported
@Override
public float getDuration() {
return duration;
return duration;
}

public long getStartTime() {
return startTime;
}

@Exported
@Override
public int getPassCount() {
Expand Down Expand Up @@ -196,17 +203,15 @@
*/
@Override
public void tally() {
passCount=failCount=skipCount=0;
passCount = failCount = skipCount = 0;
duration = 0;
for (CaseResult r : cases) {
r.setClass(this);
if (r.isSkipped()) {
skipCount++;
}
else if(r.isPassed()) {
} else if (r.isPassed()) {
passCount++;
}
else {
} else {
failCount++;
}
duration += r.getDuration();
Expand All @@ -218,7 +223,7 @@
}

public String getClassName() {
return className;
return className;
}

@Override
Expand Down Expand Up @@ -252,33 +257,33 @@
public String getDisplayName() {
return TestNameTransformer.getTransformedName(getName());
}

/**
* @since 1.515
*/
@Override
public String getFullName() {
return getParent().getName() + "." + className;
return getParent().getName() + "." + className;
}

@Override
public String getFullDisplayName() {
return getParent().getDisplayName() + "." + TestNameTransformer.getTransformedName(className);
return getParent().getDisplayName() + "." + TestNameTransformer.getTransformedName(className);
}

/**
* Gets the relative path to this test case from the given object.
*/
@Override
public String getRelativePathFrom(TestObject it) {
if(it instanceof CaseResult) {
return "..";
if (it instanceof CaseResult) {
return "..";
} else {
return super.getRelativePathFrom(it);
}
}
public void setStartTime(long start) {

public void setStartTime(long start) {
this.startTime = start;
}

Expand Down
Loading
Loading