2 * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.access.commands;
10 import static org.junit.Assert.assertNull;
11 import static org.junit.Assert.assertTrue;
13 import akka.actor.ActorRef;
14 import akka.actor.ActorSystem;
15 import org.junit.Assert;
16 import org.opendaylight.controller.cluster.access.concepts.RequestException;
17 import org.opendaylight.controller.cluster.access.concepts.RequestExceptionTest;
19 public class NotLeaderExceptionTest extends RequestExceptionTest<NotLeaderException> {
21 private static final ActorSystem ACTOR_SYSTEM = ActorSystem.apply();
22 private static final ActorRef ACTOR = new akka.testkit.TestProbe(ACTOR_SYSTEM).testActor();
23 private static final RequestException OBJECT = new NotLeaderException(ACTOR);
26 protected void isRetriable() {
27 Assert.assertFalse(OBJECT.isRetriable());
31 protected void checkMessage() {
32 final String message = OBJECT.getMessage();
33 final String checkMessage = new StringBuilder("Actor ").append(ACTOR.toString())
34 .append(" is not the current leader").toString();
35 assertTrue(checkMessage.equals(message));
36 assertNull(OBJECT.getCause());