@Test
public void testHelium2VersionApplyStateLegacy() throws Exception {
+ new ShardTestKit(getSystem()) {{
+ TestActorRef<Shard> shard = TestActorRef.create(getSystem(), newShardProps(),
+ "testHelium2VersionApplyStateLegacy");
- TestActorRef<Shard> shard = TestActorRef.create(getSystem(), newShardProps(), "testHelium2VersionApplyStateLegacy");
+ waitUntilLeader(shard);
- NormalizedNode<?, ?> node = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+ NormalizedNode<?, ?> node = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
- ApplyState applyState = new ApplyState(null, "test", new ReplicatedLogImplEntry(1, 2,
- newLegacyByteStringPayload(new WriteModification(TestModel.TEST_PATH, node))));
+ ApplyState applyState = new ApplyState(null, "test", new ReplicatedLogImplEntry(1, 2,
+ newLegacyByteStringPayload(new WriteModification(TestModel.TEST_PATH, node))));
- shard.underlyingActor().onReceiveCommand(applyState);
+ shard.underlyingActor().onReceiveCommand(applyState);
- NormalizedNode<?,?> actual = readStore(shard, TestModel.TEST_PATH);
- assertEquals("Applied state", node, actual);
+ NormalizedNode<?,?> actual = readStore(shard, TestModel.TEST_PATH);
+ assertEquals("Applied state", node, actual);
- shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
+ shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
+ }};
}
@Test
*/
package org.opendaylight.controller.sal.restconf.impl.json.to.nn.test;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import java.io.IOException;
import java.io.InputStream;
-
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
-
import org.junit.Test;
import org.opendaylight.controller.sal.rest.impl.JsonNormalizedNodeBodyReader;
import org.opendaylight.controller.sal.rest.impl.test.providers.AbstractBodyReaderTest;
countExceptions++;
}
assertNotNull(exception);
- assertEquals(
- "Error parsing input: Schema node with name cont wasn't found.",
- exception.getErrors().get(0).getErrorMessage());
+ assertThat(exception.getErrors().get(0).getErrorMessage(),
+ containsString("Error parsing input: Schema node with name cont wasn't found"));
inputStream = this.getClass().getResourceAsStream(
"/json-to-nn/wrong-top-level2.json");
countExceptions++;
}
assertNotNull(exception);
- assertEquals(
- "Error parsing input: Schema node with name lst1 wasn't found.",
- exception.getErrors().get(0).getErrorMessage());
+ assertThat(exception.getErrors().get(0).getErrorMessage(),
+ containsString("Error parsing input: Schema node with name lst1 wasn't found"));
inputStream = this.getClass().getResourceAsStream(
"/json-to-nn/wrong-top-level3.json");
countExceptions++;
}
assertNotNull(exception);
- assertEquals(
- "Error parsing input: Schema node with name lf wasn't found.",
- exception.getErrors().get(0).getErrorMessage());
+ assertThat(exception.getErrors().get(0).getErrorMessage(),
+ containsString("Error parsing input: Schema node with name lf wasn't found"));
assertEquals(3, countExceptions);
}