Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / cds-access-api / src / test / java / org / opendaylight / controller / cluster / access / commands / AbstractReadTransactionRequestTest.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.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertEquals;
13
14 import com.google.common.base.MoreObjects;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17
18 public abstract class AbstractReadTransactionRequestTest<T extends AbstractReadPathTransactionRequest<T>>
19         extends AbstractTransactionRequestTest<T> {
20     protected static final YangInstanceIdentifier PATH = YangInstanceIdentifier.of();
21     protected static final boolean SNAPSHOT_ONLY = true;
22
23     protected AbstractReadTransactionRequestTest(final T object, final int baseSize) {
24         super(object, baseSize);
25     }
26
27     @Test
28     public void getPathTest() {
29         assertEquals(PATH, object().getPath());
30     }
31
32     @Test
33     public void isSnapshotOnlyTest() {
34         assertEquals(SNAPSHOT_ONLY, object().isSnapshotOnly());
35     }
36
37     @Test
38     public void addToStringAttributesTest() {
39         final var result = object().addToStringAttributes(MoreObjects.toStringHelper(object())).toString();
40         assertThat(result, containsString("path=" + PATH));
41     }
42 }