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

Minor improvements to readability within tests #9059

Merged
merged 1 commit into from Mar 22, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions test/src/test/java/hudson/model/AbstractProjectTest.java
Expand Up @@ -245,12 +245,7 @@ public SCMDescriptor<?> getDescriptor() {
};
}
});
Thread t = new Thread() {
@Override
public void run() {
p.pollSCMChanges(StreamTaskListener.fromStdout());
}
};
Thread t = new Thread(() -> p.poll(StreamTaskListener.fromStdout()));
try {
t.start();
Future<FreeStyleBuild> f = p.scheduleBuild2(0);
Expand Down
4 changes: 2 additions & 2 deletions test/src/test/java/hudson/model/ViewTest.java
Expand Up @@ -127,8 +127,8 @@ public void roundTrip() throws Exception {
j.configRoundtrip(view);

assertEquals("Some description", view.getDescription());
assertEquals(true, view.isFilterExecutors());
assertEquals(true, view.isFilterQueue());
assertTrue(view.isFilterExecutors());
assertTrue(view.isFilterQueue());
}

@Issue("JENKINS-7100")
Expand Down
Expand Up @@ -48,7 +48,7 @@ public void reloadAgentConfig() throws Exception {
}

private void modifyNode(Node node) throws Exception {
replace(node.getNodeName().equals("") ? "config.xml" : String.format("nodes/%s/config.xml", node.getNodeName()), "oldLabel", "newLabel");
replace(node.getNodeName().isEmpty() ? "config.xml" : String.format("nodes/%s/config.xml", node.getNodeName()), "oldLabel", "newLabel");

assertEquals("oldLabel", node.getLabelString());

Expand Down
5 changes: 2 additions & 3 deletions test/src/test/java/jenkins/telemetry/TelemetryTest.java
Expand Up @@ -19,7 +19,6 @@
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.HashSet;
import java.util.Set;
import java.util.SortedSet;
Expand Down Expand Up @@ -203,7 +202,7 @@ public String getDisplayName() {
@NonNull
@Override
public LocalDate getStart() {
return LocalDate.now().plus(1, ChronoUnit.DAYS);
return LocalDate.now().plusDays(1);
}

@NonNull
Expand Down Expand Up @@ -243,7 +242,7 @@ public LocalDate getStart() {
@NonNull
@Override
public LocalDate getEnd() {
return LocalDate.now().minus(1, ChronoUnit.DAYS);
return LocalDate.now().minusDays(1);
}

@NonNull
Expand Down