Skip to content

Commit

Permalink
Minor improvements to readability within tests (#9059)
Browse files Browse the repository at this point in the history
minor improvements to readability
  • Loading branch information
StefanSpieker committed Mar 22, 2024
1 parent 706eda4 commit f73094b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
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

0 comments on commit f73094b

Please sign in to comment.