Skip to content

Commit ca30a58

Browse files
Remove invalid data types
See https://github.com/SpineEventEngine/base/issues/615 for details.
1 parent b6972c4 commit ca30a58

File tree

3 files changed

+12
-35
lines changed

3 files changed

+12
-35
lines changed

tests/model-compiler/src/test/java/io/spine/tools/protoc/ProtocPluginTest.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
package io.spine.tools.protoc;
2828

29+
import com.google.common.collect.ImmutableList;
2930
import com.google.errorprone.annotations.CanIgnoreReturnValue;
3031
import com.google.protobuf.Message;
3132
import io.spine.base.CommandMessage;
@@ -51,6 +52,7 @@
5152
import org.junit.jupiter.api.Test;
5253

5354
import java.lang.reflect.Method;
55+
import java.util.List;
5456

5557
import static com.google.common.truth.Truth.assertThat;
5658
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -119,9 +121,11 @@ void resolvePackagesFromSrcProtoIfNotSpecified() throws ClassNotFoundException {
119121
@DisplayName("skip non specified message types")
120122
void skipNonSpecifiedMessageTypes() {
121123
Class<?> cls = CustomerName.class;
122-
Class<?>[] interfaces = cls.getInterfaces();
123-
assertEquals(1, interfaces.length);
124-
assertSame(CustomerNameOrBuilder.class, interfaces[0]);
124+
List<Class<?>> interfaces = ImmutableList.copyOf(cls.getInterfaces());
125+
assertThat(interfaces).containsAtLeast(
126+
CustomerNameOrBuilder.class,
127+
io.spine.validate.MessageWithConstraints.class
128+
);
125129
}
126130

127131
@Test

tests/validation/src/test/java/io/spine/test/validate/ValidatorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
import static org.junit.jupiter.api.Assertions.assertTrue;
3838

39-
@DisplayName("MessageValidator should")
39+
@DisplayName("`MessageValidator` should")
4040
class ValidatorTest {
4141

4242
private List<ConstraintViolation> violations;

tests/validation/src/test/proto/spine/test/validate/validating_builder_test.proto

+4-31
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ message Blizzard {
148148
repeated Snowflake snowflake = 1 [(distinct) = true];
149149
}
150150

151-
message Constitution {
152-
string amendments = 1 [(distinct) = true];
153-
}
154-
155151
// Artificial blizzards allow repeating snowflakes.
156152
message ArtificialBlizzard {
157153
repeated Snowflake snowflake = 1 [(distinct) = false];
@@ -180,17 +176,6 @@ message DecimalDigit {
180176
int32 value = 1 [(range) = "[0..10)"];
181177
}
182178

183-
// A malformed range expression, the range is not closed (as in the right edge is omitted).
184-
message UpToInfinity {
185-
186-
int32 value = 1 [(range) = "[0.."];
187-
}
188-
189-
// A malformed range expression, the range is unopened (as in the left edge is omitted).
190-
message Unopened {
191-
int32 value = 1 [(range) = "..2)"];
192-
}
193-
194179
// A bet that has below 50% chance to win.
195180
message UnsafeBet {
196181
double odds = 1 [(range) = "[0.0..0.5)"];
@@ -205,8 +190,8 @@ message FrostyWeather {
205190
double celcius = 1 [(range) = "(-10.0..-5.5]"];
206191
}
207192

208-
// This message declares a field that has a value with boundary types inconsistent to its
209-
// value type.
193+
// This message declares a field that has a value with boundary types inconsistent
194+
// while the value of the value type.
210195
message FrostyWeatherButInWholeNumber {
211196

212197
// Since `celcius` is of type `double`, the boundaries cannot be of a whole
@@ -227,20 +212,8 @@ message SpacedOutBoundaries {
227212
int32 value = 1 [(range) = " [ 31..32 ) "];
228213
}
229214

230-
message MinorCitizen {
231-
232-
// Malformed range - the value the field is `int32` - whole number, while the value of the
233-
// left range edge is a floating point number.
234-
int32 age = 1 [(range) = "(0..18.01)"];
235-
}
236-
237-
// A message with a value that has a malformed range.
238-
message IllegalRanges {
239-
double value = 1 [(range) = "{0.6..4.2}"];
240-
}
241-
242-
// A snowflake is represented by a polygon. Two snowflakes are equal if they have the same
243-
// amount of edges.
215+
// A snowflake is represented by a polygon. Two snowflakes are equal if they
216+
// have the same amount of edges.
244217
message Snowflake {
245218

246219
int32 edges = 1;

0 commit comments

Comments
 (0)