Package data
Class TestCRUD
java.lang.Object
data.TestCRUD
public class TestCRUD
extends java.lang.Object
Tests Create, Read, Update, Delete operations through the Hibernate ORM,
using parameters from provided .json files.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDB_PARTIAL_RESETName of the SQL script which performs a partial reset between tests, and repopulates the tables which were reset.static java.lang.StringDB_POPULATE_SQLThe SQL script which populates the databasestatic java.lang.StringPARAMS_DIRThe directory where the test params can be found, with .json files matching class names.static java.lang.Object[][]TESTSThe array of test parameters for the tests to be run -
Constructor Summary
Constructors Constructor Description TestCRUD(data.TestCRUD.TestParams params)Instantiates a new Test crud with the provided params -
Method Summary
Modifier and Type Method Description voiddbReset()Performs a partial reset on the databasestatic java.util.CollectiongetTestParams()For JUnit to obtain the test parameters which will be passed into each instance of TestCRUDvoidtestCreate()Test create operationsvoidtestDelete()Test delete operationsvoidtestRead()Test read operationsvoidtestUpdate()Test update operations
-
Field Details
-
DB_PARTIAL_RESET
public static final java.lang.String DB_PARTIAL_RESETName of the SQL script which performs a partial reset between tests, and repopulates the tables which were reset. It resets the scan and host data tables but not the lookup tables- See Also:
- Constant Field Values
-
DB_POPULATE_SQL
public static final java.lang.String DB_POPULATE_SQLThe SQL script which populates the database- See Also:
- Constant Field Values
-
PARAMS_DIR
public static final java.lang.String PARAMS_DIRThe directory where the test params can be found, with .json files matching class names.- See Also:
- Constant Field Values
-
TESTS
public static final java.lang.Object[][] TESTSThe array of test parameters for the tests to be run
-
-
Constructor Details
-
TestCRUD
public TestCRUD(data.TestCRUD.TestParams params)Instantiates a new Test crud with the provided params- Parameters:
params- the params
-
-
Method Details
-
dbReset
public void dbReset() throws java.io.FileNotFoundExceptionPerforms a partial reset on the database- Throws:
java.io.FileNotFoundException- the file not found exception
-
testCreate
public void testCreate()Test create operations -
testUpdate
public void testUpdate()Test update operations -
testDelete
public void testDelete()Test delete operations -
testRead
public void testRead()Test read operations -
getTestParams
public static java.util.Collection getTestParams() throws java.lang.NoSuchFieldException, java.lang.IllegalAccessException, java.io.IOExceptionFor JUnit to obtain the test parameters which will be passed into each instance of TestCRUD- Returns:
- the test params
- Throws:
java.lang.NoSuchFieldException- the no such field exceptionjava.lang.IllegalAccessException- the illegal access exceptionjava.io.IOException- the io exception
-