|
@@ -6,11 +6,15 @@
|
|
|
*/
|
|
|
package org.elasticsearch.xpack.core.ilm;
|
|
|
|
|
|
+import org.elasticsearch.common.Strings;
|
|
|
import org.elasticsearch.common.io.stream.Writeable;
|
|
|
import org.elasticsearch.test.AbstractSerializingTestCase;
|
|
|
import org.elasticsearch.xcontent.XContentParser;
|
|
|
+import org.elasticsearch.xcontent.json.JsonXContent;
|
|
|
import org.elasticsearch.xpack.core.ilm.Step.StepKey;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
public class StepKeyTests extends AbstractSerializingTestCase<StepKey> {
|
|
|
|
|
|
@Override
|
|
@@ -47,4 +51,14 @@ public class StepKeyTests extends AbstractSerializingTestCase<StepKey> {
|
|
|
|
|
|
return new StepKey(phase, action, step);
|
|
|
}
|
|
|
+
|
|
|
+ public void testToString() throws IOException {
|
|
|
+ // toString yields parseable json
|
|
|
+ StepKey s = randomStepKey();
|
|
|
+ XContentParser parser = createParser(JsonXContent.jsonXContent, s.toString());
|
|
|
+ assertEquals(s, StepKey.parse(parser));
|
|
|
+
|
|
|
+ // although we're not actually using Strings.toString for performance reasons, we expect the same result as if we had
|
|
|
+ assertEquals(Strings.toString(s), s.toString());
|
|
|
+ }
|
|
|
}
|