[OLINGO-1152] Test case for null enum values

Signed-off-by: Christian Amend <christian.amend@sap.com>
This commit is contained in:
Tom van Wietmarschen 2017-08-22 15:08:20 +02:00 committed by Christian Amend
parent 6b34920a5b
commit 0a2ebd7953
2 changed files with 21 additions and 0 deletions

View File

@ -36,6 +36,7 @@ import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientCollectionValue;
import org.apache.olingo.client.api.domain.ClientComplexValue;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.core.serialization.JsonDeserializer;
import org.apache.olingo.commons.api.Constants;
@ -482,4 +483,18 @@ public class JSONTest extends AbstractTest {
i++;
}
}
@Test
public void issueOLINGO1152() throws Exception {
InputStream inputStream = getClass().getResourceAsStream(
"olingo1152" + "." + getSuffix(ContentType.APPLICATION_JSON));
ClientEntity entity = client.getReader().readEntity(inputStream, ContentType.APPLICATION_JSON);
assertNotNull(entity);
ClientProperty prop = entity.getProperty("Gender");
assertNotNull(prop);
ClientValue value = prop.getValue();
assertNotNull(value);
assertTrue(value.asEnum() == null);
}
}

View File

@ -0,0 +1,6 @@
{
"@odata.type": "#Microsoft.OData.SampleService.Models.TripPin.Person",
"@odata.id": "http://services.odata.org/V4/(S(fe5rsnxo3fkkkk2bvmh1nl1y))/TripPinServiceRW/People('russellwhyte')",
"Gender@odata.type": "#Microsoft.OData.SampleService.Models.TripPin.PersonGender",
"Gender": null
}