use of com.mesosphere.sdk.http.types.StringPropertyDeserializer in project dcos-commons by mesosphere.
the class StateQueriesTest method testGetPropertyFails.
@Test
public void testGetPropertyFails() {
when(mockStateStore.fetchProperty("foo")).thenThrow(new StateStoreException(Reason.UNKNOWN, "hi"));
Response response = StateQueries.getProperty(mockStateStore, new StringPropertyDeserializer(), "foo");
assertEquals(500, response.getStatus());
}
use of com.mesosphere.sdk.http.types.StringPropertyDeserializer in project dcos-commons by mesosphere.
the class StateQueriesTest method testGetProperty.
@Test
public void testGetProperty() {
byte[] property = "hello this is a property".getBytes(StandardCharsets.UTF_8);
when(mockStateStore.fetchProperty("foo")).thenReturn(property);
Response response = StateQueries.getProperty(mockStateStore, new StringPropertyDeserializer(), "foo");
assertEquals(200, response.getStatus());
assertEquals("hello this is a property", response.getEntity());
}
use of com.mesosphere.sdk.http.types.StringPropertyDeserializer in project dcos-commons by mesosphere.
the class StateQueriesTest method testGetPropertyMissing.
@Test
public void testGetPropertyMissing() {
when(mockStateStore.fetchProperty("foo")).thenThrow(new StateStoreException(Reason.NOT_FOUND, "hi"));
Response response = StateQueries.getProperty(mockStateStore, new StringPropertyDeserializer(), "foo");
assertEquals(404, response.getStatus());
}
Aggregations