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