Coverage Summary for Class: Persister (com.acciente.oacc.sql.internal.persister)

Class Class, % Method, % Line, %
Persister 100% (1/ 1) 100% (4/ 4) 69.2% (9/ 13)


1 /* 2  * Copyright 2009-2018, Acciente LLC 3  * 4  * Acciente LLC licenses this file to you under the 5  * Apache License, Version 2.0 (the "License"); you 6  * may not use this file except in compliance with the 7  * License. You may obtain a copy of the License at 8  * 9  * http://www.apache.org/licenses/LICENSE-2.0 10  * 11  * Unless required by applicable law or agreed to in 12  * writing, software distributed under the License is 13  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 14  * OR CONDITIONS OF ANY KIND, either express or implied. 15  * See the License for the specific language governing 16  * permissions and limitations under the License. 17  */ 18 package com.acciente.oacc.sql.internal.persister; 19  20 import java.io.Serializable; 21 import java.sql.SQLException; 22  23 /** 24  * Base class for persisters 25  */ 26 public abstract class Persister implements Serializable { 27  private static final long serialVersionUID = 1L; 28  29  protected static void closeStatement(SQLStatement statement) { 30  try { 31  if (statement != null) { 32  statement.close(); 33  } 34  } 35  catch (SQLException e) { 36  throw new RuntimeException(e); 37  } 38  } 39  40  // data verification helpers 41  42  protected void assertOneRowInserted(int rowCount) { 43  if (rowCount != 1) { 44  throw new IllegalStateException("Security table data insert, 1 row expected, got: " + rowCount); 45  } 46  } 47  48  protected void assertOneRowUpdated(int rowCount) { 49  if (rowCount != 1) { 50  throw new IllegalStateException("Security table data update, 1 row expected, got: " + rowCount); 51  } 52  } 53 }