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 com.google.common.base.MoreObjects;
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.controller.cluster.access.ABIVersion;
15 public class ExistsTransactionSuccessTest extends AbstractTransactionSuccessTest<ExistsTransactionSuccess> {
16 private static final boolean EXISTS = true;
18 private static final ExistsTransactionSuccess OBJECT = new ExistsTransactionSuccess(
19 TRANSACTION_IDENTIFIER, 0, EXISTS);
22 protected ExistsTransactionSuccess object() {
27 public void getExistsTest() throws Exception {
28 final boolean result = OBJECT.getExists();
29 Assert.assertEquals(EXISTS, result);
33 public void cloneAsVersionTest() throws Exception {
34 final ExistsTransactionSuccess clone = OBJECT.cloneAsVersion(ABIVersion.BORON);
35 Assert.assertEquals(OBJECT, clone);
39 public void addToStringAttributesTest() throws Exception {
40 final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
41 Assert.assertTrue(result.toString().contains("exists=" + EXISTS));
45 protected void doAdditionalAssertions(final Object deserialize) {
46 Assert.assertTrue(deserialize instanceof ExistsTransactionSuccess);
47 Assert.assertEquals(OBJECT.getExists(), ((ExistsTransactionSuccess) deserialize).getExists());