2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2019 IBM.
6 * ===================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ============LICENSE_END=============================================
20 * ====================================================================
23 package org.onap.music.datastore;
25 import static org.junit.Assert.assertEquals;
27 import org.junit.Before;
28 import org.junit.Test;
30 public class PreparedQueryObjectTest {
32 private PreparedQueryObject preparedQueryObject;
37 preparedQueryObject = new PreparedQueryObject();
41 public void testKeyspaceName()
43 preparedQueryObject.setKeyspaceName("keyspaceName");
44 assertEquals("keyspaceName", preparedQueryObject.getKeyspaceName());
48 public void testConsistency()
50 preparedQueryObject.setConsistency("consistency");
51 assertEquals("consistency", preparedQueryObject.getConsistency());
55 public void testTableName()
57 preparedQueryObject.setTableName("tableName");
58 assertEquals("tableName", preparedQueryObject.getTableName());
62 public void testoperation()
64 preparedQueryObject.setOperation("operation");
65 assertEquals("operation", preparedQueryObject.getOperation());
69 public void testprimaryKeyValue()
71 preparedQueryObject.setPrimaryKeyValue("primaryKeyValue");
72 assertEquals("primaryKeyValue", preparedQueryObject.getPrimaryKeyValue());
76 public void testAddValue() {
77 preparedQueryObject.addValue("one");
78 assertEquals("one", preparedQueryObject.getValues().get(0));
82 public void testAddValues() {
83 preparedQueryObject.addValues("one", "two", "three");
84 assertEquals(3, preparedQueryObject.getValues().size());
85 assertEquals("two", preparedQueryObject.getValues().get(1));
89 public void testConstructorQuery() {
90 preparedQueryObject = new PreparedQueryObject("some query string");
91 assertEquals("some query string", preparedQueryObject.getQuery());
95 public void testConstructorQueryValues() {
96 preparedQueryObject = new PreparedQueryObject("another query string", "a", "b", "c");
97 assertEquals("another query string", preparedQueryObject.getQuery());
98 assertEquals(3, preparedQueryObject.getValues().size());
99 assertEquals("b", preparedQueryObject.getValues().get(1));