Unnecessary boxing was removed from tests (#30250)

This commit is contained in:
Andrei Arlou 2021-05-31 16:46:14 +03:00 committed by GitHub
parent 622d8af0ef
commit 206dafa01d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 26 deletions

View file

@ -194,14 +194,7 @@ public class JavaAPI extends JUnitSuite {
}
public void onReceive(Object msg) {
String reply =
String.valueOf(a)
+ "-"
+ String.valueOf(b)
+ "-"
+ String.valueOf(c)
+ "-"
+ String.valueOf(d);
String reply = a + "-" + b + "-" + c + "-" + d;
getSender().tell(reply, getSelf());
}
}

View file

@ -16,7 +16,7 @@ public class StashJavaAPITestActors {
Object msg, int count, ActorRef sender, ActorRef self, UnrestrictedStash stash) {
if (msg instanceof String) {
if (count < 0) {
sender.tell(Integer.valueOf(((String) msg).length()), self);
sender.tell(((String) msg).length(), self);
} else if (count == 2) {
stash.unstashAll();
return -1;

View file

@ -6,10 +6,7 @@ package akka.japi;
import akka.japi.pf.FI;
import akka.japi.pf.Match;
import org.junit.Rule;
import org.junit.Assert;
import org.junit.function.ThrowingRunnable;
import org.junit.rules.ExpectedException;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
import scala.MatchError;
@ -47,13 +44,7 @@ public class MatchBuilderTest extends JUnitSuite {
Double.valueOf(-47110).equals(pf.match(Double.valueOf(4711))));
Assert.assertThrows(
"A string should throw a MatchError",
MatchError.class,
new ThrowingRunnable() {
public void run() {
pf.match("4711");
}
});
"A string should throw a MatchError", MatchError.class, () -> pf.match("4711"));
}
static class GenericClass<T> {
@ -77,9 +68,10 @@ public class MatchBuilderTest extends JUnitSuite {
}
}));
assertTrue(
assertEquals(
"String value should be extract from GenericMessage",
"A".equals(pf.match(new GenericClass<String>("A"))));
"A",
pf.match(new GenericClass<>("A")));
}
@Test
@ -104,10 +96,6 @@ public class MatchBuilderTest extends JUnitSuite {
Assert.assertThrows(
"empty GenericMessage should throw match error",
MatchError.class,
new ThrowingRunnable() {
public void run() {
pf.match(new GenericClass<String>(""));
}
});
() -> pf.match(new GenericClass<>("")));
}
}