refactor: improved information hiding in RequestDeserializerTest
This commit is contained in:
parent
bf574cec1e
commit
a69d8b916f
@ -117,14 +117,14 @@ public class RequestSerializerTest {
|
||||
}
|
||||
|
||||
@Provide("gameRequests")
|
||||
public static Arbitrary<GameRequest> gameRequests() {
|
||||
private Arbitrary<GameRequest> gameRequests() {
|
||||
return requestBuilders()
|
||||
.map(RequestBuilder::buildGameRequest)
|
||||
.filter(request -> gameRequestTypes.contains(request.type));
|
||||
}
|
||||
|
||||
@Provide("characterRequests")
|
||||
public static Arbitrary<CharacterRequest> characterRequests() {
|
||||
private Arbitrary<CharacterRequest> characterRequests() {
|
||||
return requestBuilders()
|
||||
.map(RequestBuilder::buildCharacterRequest)
|
||||
.filter(request -> characterRequestTypes.contains(request.type));
|
||||
@ -132,7 +132,7 @@ public class RequestSerializerTest {
|
||||
|
||||
|
||||
@Provide("filledRequestBuilders")
|
||||
public static Arbitrary<RequestBuilder> requestBuilders() {
|
||||
private Arbitrary<RequestBuilder> requestBuilders() {
|
||||
var emptyBuilders = Arbitraries.of(RequestType.class)
|
||||
.map(RequestBuilder::new);
|
||||
|
||||
@ -171,7 +171,7 @@ public class RequestSerializerTest {
|
||||
}
|
||||
|
||||
@Provide("entityIDs")
|
||||
public static Arbitrary<EntityID> entityIDs() {
|
||||
private Arbitrary<EntityID> entityIDs() {
|
||||
var entityTypes = Arbitraries.of(EntityType.class);
|
||||
return Combinators.combine(entityTypes, Arbitraries.integers().greaterOrEqual(0))
|
||||
.as((type, id) -> {
|
||||
@ -188,7 +188,7 @@ public class RequestSerializerTest {
|
||||
}
|
||||
|
||||
@Provide("randomPositions")
|
||||
public static Arbitrary<IntVector2> randomPositions() {
|
||||
private Arbitrary<IntVector2> randomPositions() {
|
||||
return Arbitraries.integers()
|
||||
.greaterOrEqual(0)
|
||||
.tuple2()
|
||||
@ -196,7 +196,7 @@ public class RequestSerializerTest {
|
||||
}
|
||||
|
||||
@Provide("directions")
|
||||
public static Arbitrary<IntVector2> directions() {
|
||||
private Arbitrary<IntVector2> directions() {
|
||||
return Arbitraries.integers()
|
||||
.between(-1, 1)
|
||||
.tuple2()
|
||||
@ -206,7 +206,7 @@ public class RequestSerializerTest {
|
||||
|
||||
@Provide("attackPositions")
|
||||
/** Returns tuples of origin vectors (of an attack), and the vector pointing to the attack dir */
|
||||
public static Arbitrary<Tuple.Tuple2<IntVector2, IntVector2>> attackPositions() {
|
||||
private Arbitrary<Tuple.Tuple2<IntVector2, IntVector2>> attackPositions() {
|
||||
return Combinators.combine(randomPositions(), directions().tuple5())
|
||||
.as((origin, dir) -> {
|
||||
var attackField = origin.copy()
|
||||
|
Loading…
Reference in New Issue
Block a user