String performance and maintenability
[controller.git] / opendaylight / md-sal / cds-access-api / src / test / java / org / opendaylight / controller / cluster / access / commands / NotLeaderExceptionTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.access.commands;
9
10 import static org.junit.Assert.assertNull;
11 import static org.junit.Assert.assertTrue;
12
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;
18
19 public class NotLeaderExceptionTest extends RequestExceptionTest<NotLeaderException> {
20
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);
24
25     @Override
26     protected void isRetriable() {
27         Assert.assertFalse(OBJECT.isRetriable());
28     }
29
30     @Override
31     protected void checkMessage() {
32         final String message = OBJECT.getMessage();
33         final String checkMessage = "Actor " + ACTOR + " is not the current leader";
34         assertTrue(checkMessage.equals(message));
35         assertNull(OBJECT.getCause());
36     }
37
38 }