You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2011/09/17 01:10:45 UTC

Re: svn commit: r1171846 - /commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java

On 17 September 2011 00:02,  <si...@apache.org> wrote:
> Author: simonetripodi
> Date: Fri Sep 16 23:02:58 2011
> New Revision: 1171846
>
> URL: http://svn.apache.org/viewvc?rev=1171846&view=rev
> Log:
> muted 'variable res is never read' warnings

If they are really not used, why not remove them?

> Modified:
>    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
>
> Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
> URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java?rev=1171846&r1=1171845&r2=1171846&view=diff
> ==============================================================================
> --- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java (original)
> +++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java Fri Sep 16 23:02:58 2011
> @@ -69,6 +69,7 @@ public class QueryRunnerTest {
>
>     private void callGoodBatch(Connection conn, Object[][] params) throws Exception {
>         when(meta.getParameterCount()).thenReturn(2);
> +        @SuppressWarnings( "unused" )
>         int[] ret = runner.batch(conn, "select * from blah where ? = ?", params);
>
>         verify(stmt, times(2)).addBatch();
> @@ -79,6 +80,7 @@ public class QueryRunnerTest {
>
>     private void callGoodBatch(Object[][] params) throws Exception {
>         when(meta.getParameterCount()).thenReturn(2);
> +        @SuppressWarnings( "unused" )
>         int[] ret = runner.batch("select * from blah where ? = ?", params);
>
>         verify(stmt, times(2)).addBatch();
> @@ -121,6 +123,7 @@ public class QueryRunnerTest {
>
>     // helper method for calling batch when an exception is expected
>     private void callBatchWithException(String sql, Object[][] params) throws Exception {
> +        @SuppressWarnings( "unused" )
>         int[] ret = null;
>         boolean caught = false;
>
> @@ -203,6 +206,7 @@ public class QueryRunnerTest {
>     //
>     private void callGoodQuery(Connection conn) throws Exception {
>         when(meta.getParameterCount()).thenReturn(2);
> +        @SuppressWarnings( "unused" )
>         Object[] ret = runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test");
>
>         verify(stmt, times(1)).executeQuery();
> @@ -222,6 +226,7 @@ public class QueryRunnerTest {
>
>     private void callGoodQuery() throws Exception {
>         when(meta.getParameterCount()).thenReturn(2);
> +        @SuppressWarnings( "unused" )
>         Object[] ret = runner.query("select * from blah where ? = ?", handler, "unit", "test");
>
>         verify(stmt, times(1)).executeQuery();
> @@ -259,6 +264,7 @@ public class QueryRunnerTest {
>
>     // helper method for calling batch when an exception is expected
>     private void callQueryWithException(Object... params) throws Exception {
> +        @SuppressWarnings( "unused" )
>         Object[] ret = null;
>         boolean caught = false;
>
> @@ -329,6 +335,7 @@ public class QueryRunnerTest {
>     //
>     private void callGoodUpdate(Connection conn) throws Exception {
>         when(meta.getParameterCount()).thenReturn(2);
> +        @SuppressWarnings( "unused" )
>         Integer ret = runner.update(conn, "update blah set ? = ?", "unit", "test");
>
>         verify(stmt, times(1)).executeUpdate();
> @@ -354,6 +361,7 @@ public class QueryRunnerTest {
>
>     private void callGoodUpdate() throws Exception {
>         when(meta.getParameterCount()).thenReturn(2);
> +        @SuppressWarnings( "unused" )
>         Integer ret = runner.update("update blah set ? = ?", "unit", "test");
>
>         verify(stmt, times(1)).executeUpdate();
> @@ -396,6 +404,7 @@ public class QueryRunnerTest {
>
>     // helper method for calling batch when an exception is expected
>     private void callUpdateWithException(Object... params) throws Exception {
> +        @SuppressWarnings( "unused" )
>         Integer ret = null;
>         boolean caught = false;
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1171846 - /commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java

Posted by Bill Speirs <bi...@gmail.com>.
Yea... I created these tests, and those values are not used. The DataSource
which is used to call the commands is mocked and will simply (and always)
return null.

Good catch...

Bill-

On Sat, Sep 17, 2011 at 4:06 AM, Simone Tripodi <si...@apache.org>wrote:

> ouch, I was convinced I was fixing the async test :P
> It makes sense, let's remove them!
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://www.99soft.org/
>
>
>
> On Sat, Sep 17, 2011 at 1:10 AM, sebb <se...@gmail.com> wrote:
> > On 17 September 2011 00:02,  <si...@apache.org> wrote:
> >> Author: simonetripodi
> >> Date: Fri Sep 16 23:02:58 2011
> >> New Revision: 1171846
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1171846&view=rev
> >> Log:
> >> muted 'variable res is never read' warnings
> >
> > If they are really not used, why not remove them?
> >
> >> Modified:
> >>
>  commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
> >>
> >> Modified:
> commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
> >> URL:
> http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java?rev=1171846&r1=1171845&r2=1171846&view=diff
> >>
> ==============================================================================
> >> ---
> commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
> (original)
> >> +++
> commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
> Fri Sep 16 23:02:58 2011
> >> @@ -69,6 +69,7 @@ public class QueryRunnerTest {
> >>
> >>     private void callGoodBatch(Connection conn, Object[][] params)
> throws Exception {
> >>         when(meta.getParameterCount()).thenReturn(2);
> >> +        @SuppressWarnings( "unused" )
> >>         int[] ret = runner.batch(conn, "select * from blah where ? = ?",
> params);
> >>
> >>         verify(stmt, times(2)).addBatch();
> >> @@ -79,6 +80,7 @@ public class QueryRunnerTest {
> >>
> >>     private void callGoodBatch(Object[][] params) throws Exception {
> >>         when(meta.getParameterCount()).thenReturn(2);
> >> +        @SuppressWarnings( "unused" )
> >>         int[] ret = runner.batch("select * from blah where ? = ?",
> params);
> >>
> >>         verify(stmt, times(2)).addBatch();
> >> @@ -121,6 +123,7 @@ public class QueryRunnerTest {
> >>
> >>     // helper method for calling batch when an exception is expected
> >>     private void callBatchWithException(String sql, Object[][] params)
> throws Exception {
> >> +        @SuppressWarnings( "unused" )
> >>         int[] ret = null;
> >>         boolean caught = false;
> >>
> >> @@ -203,6 +206,7 @@ public class QueryRunnerTest {
> >>     //
> >>     private void callGoodQuery(Connection conn) throws Exception {
> >>         when(meta.getParameterCount()).thenReturn(2);
> >> +        @SuppressWarnings( "unused" )
> >>         Object[] ret = runner.query(conn, "select * from blah where ? =
> ?", handler, "unit", "test");
> >>
> >>         verify(stmt, times(1)).executeQuery();
> >> @@ -222,6 +226,7 @@ public class QueryRunnerTest {
> >>
> >>     private void callGoodQuery() throws Exception {
> >>         when(meta.getParameterCount()).thenReturn(2);
> >> +        @SuppressWarnings( "unused" )
> >>         Object[] ret = runner.query("select * from blah where ? = ?",
> handler, "unit", "test");
> >>
> >>         verify(stmt, times(1)).executeQuery();
> >> @@ -259,6 +264,7 @@ public class QueryRunnerTest {
> >>
> >>     // helper method for calling batch when an exception is expected
> >>     private void callQueryWithException(Object... params) throws
> Exception {
> >> +        @SuppressWarnings( "unused" )
> >>         Object[] ret = null;
> >>         boolean caught = false;
> >>
> >> @@ -329,6 +335,7 @@ public class QueryRunnerTest {
> >>     //
> >>     private void callGoodUpdate(Connection conn) throws Exception {
> >>         when(meta.getParameterCount()).thenReturn(2);
> >> +        @SuppressWarnings( "unused" )
> >>         Integer ret = runner.update(conn, "update blah set ? = ?",
> "unit", "test");
> >>
> >>         verify(stmt, times(1)).executeUpdate();
> >> @@ -354,6 +361,7 @@ public class QueryRunnerTest {
> >>
> >>     private void callGoodUpdate() throws Exception {
> >>         when(meta.getParameterCount()).thenReturn(2);
> >> +        @SuppressWarnings( "unused" )
> >>         Integer ret = runner.update("update blah set ? = ?", "unit",
> "test");
> >>
> >>         verify(stmt, times(1)).executeUpdate();
> >> @@ -396,6 +404,7 @@ public class QueryRunnerTest {
> >>
> >>     // helper method for calling batch when an exception is expected
> >>     private void callUpdateWithException(Object... params) throws
> Exception {
> >> +        @SuppressWarnings( "unused" )
> >>         Integer ret = null;
> >>         boolean caught = false;
> >>
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: svn commit: r1171846 - /commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java

Posted by Simone Tripodi <si...@apache.org>.
ouch, I was convinced I was fixing the async test :P
It makes sense, let's remove them!
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Sat, Sep 17, 2011 at 1:10 AM, sebb <se...@gmail.com> wrote:
> On 17 September 2011 00:02,  <si...@apache.org> wrote:
>> Author: simonetripodi
>> Date: Fri Sep 16 23:02:58 2011
>> New Revision: 1171846
>>
>> URL: http://svn.apache.org/viewvc?rev=1171846&view=rev
>> Log:
>> muted 'variable res is never read' warnings
>
> If they are really not used, why not remove them?
>
>> Modified:
>>    commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
>>
>> Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
>> URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java?rev=1171846&r1=1171845&r2=1171846&view=diff
>> ==============================================================================
>> --- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java (original)
>> +++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java Fri Sep 16 23:02:58 2011
>> @@ -69,6 +69,7 @@ public class QueryRunnerTest {
>>
>>     private void callGoodBatch(Connection conn, Object[][] params) throws Exception {
>>         when(meta.getParameterCount()).thenReturn(2);
>> +        @SuppressWarnings( "unused" )
>>         int[] ret = runner.batch(conn, "select * from blah where ? = ?", params);
>>
>>         verify(stmt, times(2)).addBatch();
>> @@ -79,6 +80,7 @@ public class QueryRunnerTest {
>>
>>     private void callGoodBatch(Object[][] params) throws Exception {
>>         when(meta.getParameterCount()).thenReturn(2);
>> +        @SuppressWarnings( "unused" )
>>         int[] ret = runner.batch("select * from blah where ? = ?", params);
>>
>>         verify(stmt, times(2)).addBatch();
>> @@ -121,6 +123,7 @@ public class QueryRunnerTest {
>>
>>     // helper method for calling batch when an exception is expected
>>     private void callBatchWithException(String sql, Object[][] params) throws Exception {
>> +        @SuppressWarnings( "unused" )
>>         int[] ret = null;
>>         boolean caught = false;
>>
>> @@ -203,6 +206,7 @@ public class QueryRunnerTest {
>>     //
>>     private void callGoodQuery(Connection conn) throws Exception {
>>         when(meta.getParameterCount()).thenReturn(2);
>> +        @SuppressWarnings( "unused" )
>>         Object[] ret = runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test");
>>
>>         verify(stmt, times(1)).executeQuery();
>> @@ -222,6 +226,7 @@ public class QueryRunnerTest {
>>
>>     private void callGoodQuery() throws Exception {
>>         when(meta.getParameterCount()).thenReturn(2);
>> +        @SuppressWarnings( "unused" )
>>         Object[] ret = runner.query("select * from blah where ? = ?", handler, "unit", "test");
>>
>>         verify(stmt, times(1)).executeQuery();
>> @@ -259,6 +264,7 @@ public class QueryRunnerTest {
>>
>>     // helper method for calling batch when an exception is expected
>>     private void callQueryWithException(Object... params) throws Exception {
>> +        @SuppressWarnings( "unused" )
>>         Object[] ret = null;
>>         boolean caught = false;
>>
>> @@ -329,6 +335,7 @@ public class QueryRunnerTest {
>>     //
>>     private void callGoodUpdate(Connection conn) throws Exception {
>>         when(meta.getParameterCount()).thenReturn(2);
>> +        @SuppressWarnings( "unused" )
>>         Integer ret = runner.update(conn, "update blah set ? = ?", "unit", "test");
>>
>>         verify(stmt, times(1)).executeUpdate();
>> @@ -354,6 +361,7 @@ public class QueryRunnerTest {
>>
>>     private void callGoodUpdate() throws Exception {
>>         when(meta.getParameterCount()).thenReturn(2);
>> +        @SuppressWarnings( "unused" )
>>         Integer ret = runner.update("update blah set ? = ?", "unit", "test");
>>
>>         verify(stmt, times(1)).executeUpdate();
>> @@ -396,6 +404,7 @@ public class QueryRunnerTest {
>>
>>     // helper method for calling batch when an exception is expected
>>     private void callUpdateWithException(Object... params) throws Exception {
>> +        @SuppressWarnings( "unused" )
>>         Integer ret = null;
>>         boolean caught = false;
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org