3030
3131import static org .junit .Assert .assertEquals ;
3232import static org .junit .Assert .assertTrue ;
33+ import static org .spine3 .base .Mismatch .getActualString ;
34+ import static org .spine3 .base .Mismatch .getExpectedString ;
3335import static org .spine3 .protobuf .AnyPacker .unpack ;
3436import static org .spine3 .protobuf .Values .newStringValue ;
3537import static org .spine3 .test .Tests .hasPrivateUtilityConstructor ;
3941 */
4042public class MismatchShould {
4143
42- private static final String REQUESTED = "requested" ;
4344 private static final String EXPECTED = "expected" ;
4445 private static final String ACTUAL = "ACTUAL" ;
4546 private static final int VERSION = 0 ;
@@ -83,7 +84,6 @@ public void return_mismatch_object_with_string_values() {
8384 public void return_mismatch_object_with_int32_values () {
8485 final int expected = 0 ;
8586 final int actual = 1 ;
86- final int requested = 2 ;
8787 final ValueMismatch mismatch = Mismatch .of (expected , actual , VERSION );
8888 final Int32Value expectedWrapper = unpack (mismatch .getExpected ());
8989 final Int32Value actualWrapper = unpack (mismatch .getActual ());
@@ -96,7 +96,6 @@ public void return_mismatch_object_with_int32_values() {
9696 public void return_mismatch_object_with_int64_values () {
9797 final long expected = 0L ;
9898 final long actual = 1L ;
99- final long requested = 2L ;
10099 final ValueMismatch mismatch = Mismatch .of (expected , actual , VERSION );
101100 final Int64Value expectedWrapped = unpack (mismatch .getExpected ());
102101 final Int64Value actualWrapped = unpack (mismatch .getActual ());
@@ -109,7 +108,6 @@ public void return_mismatch_object_with_int64_values() {
109108 public void return_mismatch_object_with_float_values () {
110109 final float expected = 0.0F ;
111110 final float actual = 1.0F ;
112- final float requested = 2.0F ;
113111 final ValueMismatch mismatch = Mismatch .of (expected , actual , VERSION );
114112 final FloatValue expectedWrapped = unpack (mismatch .getExpected ());
115113 final FloatValue actualWrapped = unpack (mismatch .getActual ());
@@ -122,7 +120,6 @@ public void return_mismatch_object_with_float_values() {
122120 public void return_mismatch_object_with_double_values () {
123121 final double expected = 0.1 ;
124122 final double actual = 0.2 ;
125- final double requested = 0.3 ;
126123 final ValueMismatch mismatch = Mismatch .of (expected , actual , VERSION );
127124 final DoubleValue expectedWrapped = unpack (mismatch .getExpected ());
128125 final DoubleValue actualWrapped = unpack (mismatch .getActual ());
@@ -135,7 +132,6 @@ public void return_mismatch_object_with_double_values() {
135132 public void return_mismatch_object_with_boolean_values () {
136133 final boolean expected = true ;
137134 final boolean actual = false ;
138- final boolean requested = true ;
139135 final ValueMismatch mismatch = Mismatch .of (expected , actual , VERSION );
140136 final BoolValue expectedWrapped = unpack (mismatch .getExpected ());
141137 final BoolValue actualWrapped = unpack (mismatch .getActual ());
@@ -171,4 +167,16 @@ public void return_mismatch_object_with_message_values() {
171167 assertEquals (EXPECTED , expected .getValue ());
172168 assertEquals (ACTUAL , actual .getValue ());
173169 }
170+
171+ @ Test
172+ public void return_expected_string () {
173+ final ValueMismatch mismatch = Mismatch .of (newStringValue (EXPECTED ), newStringValue (ACTUAL ), VERSION );
174+ assertEquals (EXPECTED , getExpectedString (mismatch ));
175+ }
176+
177+ @ Test
178+ public void return_actual_string () {
179+ final ValueMismatch mismatch = Mismatch .of (newStringValue (EXPECTED ), newStringValue (ACTUAL ), VERSION );
180+ assertEquals (ACTUAL , getActualString (mismatch ));
181+ }
174182}
0 commit comments