### Question:
GeneralAdminInpForSQ extends AbstractIRODSPackingInstruction { public static final GeneralAdminInpForSQ instanceForAddSpecificQuery(final SpecificQueryDefinition specificQuery) throws JargonException { if (specificQuery == null) { throw new IllegalArgumentException("null SpecificQueryDefinition object"); } String query = specificQuery.getSql(); String alias = specificQuery.getAlias(); GeneralAdminInpForSQ generalAdminInpForSQ = new GeneralAdminInpForSQ(query, alias, SQ_ADD); return generalAdminInpForSQ; } private  GeneralAdminInpForSQ(final String query, final String alias, final String action); static final GeneralAdminInpForSQ instanceForAddSpecificQuery(final SpecificQueryDefinition specificQuery); static final GeneralAdminInpForSQ instanceForRemoveSpecificQuery(final SpecificQueryDefinition specificQuery); static final GeneralAdminInpForSQ instanceForRemoveSpecificQueryByAlias(final String alias); static final GeneralAdminInpForSQ instanceForRemoveAllSpecificQueryBySQL(final String query); @Override Tag getTagValue(); String getSqlQuery(); void setSqlQuery(final String sqlQuery); String getAlias(); void setAlias(final String alias); String getAction(); void setAction(final String action);  }### Answer:
@Test public void testAddSpecificQuery() throws Exception { String query = "select count(data_id) from r_data_main"; String alias = "get_dataobject_ids"; SpecificQueryDefinition specificQuery = new SpecificQueryDefinition(query, alias); GeneralAdminInpForSQ pi = GeneralAdminInpForSQ.instanceForAddSpecificQuery(specificQuery); Assert.assertNotNull(pi); }
@Test public void testAddSpecificQueryCheckXML() throws Exception { String query = "select count(data_id) from r_data_main"; String alias = "get_dataobject_ids"; SpecificQueryDefinition specificQuery = new SpecificQueryDefinition(query, alias); GeneralAdminInpForSQ pi = GeneralAdminInpForSQ.instanceForAddSpecificQuery(specificQuery); String tagOut = pi.getParsedTags(); StringBuilder sb = new StringBuilder(); sb.append("<generalAdminInp_PI><arg0>add</arg0>\n"); sb.append("<arg1>specificQuery</arg1>\n"); sb.append("<arg2>"); sb.append(query); sb.append("</arg2>\n"); sb.append("<arg3>"); sb.append(alias); sb.append("</arg3>\n"); sb.append("<arg4></arg4>\n"); sb.append("<arg5></arg5>\n"); sb.append("<arg6></arg6>\n"); sb.append("<arg7></arg7>\n"); sb.append("<arg8></arg8>\n"); sb.append("<arg9></arg9>\n"); sb.append("</generalAdminInp_PI>\n"); Assert.assertEquals("unexpected XML protocol result", sb.toString(), tagOut); }
@Test(expected = IllegalArgumentException.class) public void testAddSpecificQueryNullSQ() throws Exception { GeneralAdminInpForSQ.instanceForAddSpecificQuery(null); }
@Test(expected = IllegalArgumentException.class) public void testAddSpecificQueryNullQuery() throws Exception { SpecificQueryDefinition specificQuery = new SpecificQueryDefinition(null, "neato_query"); GeneralAdminInpForSQ.instanceForAddSpecificQuery(specificQuery); }
@Test(expected = IllegalArgumentException.class) public void testAddSpecificQueryNullAlias() throws Exception { String query = "select count(data_id) from r_data_main"; SpecificQueryDefinition specificQuery = new SpecificQueryDefinition(query, null); GeneralAdminInpForSQ.instanceForAddSpecificQuery(specificQuery); }