Skip to content

Commit 204433b

Browse files
committed
bugfix: clean up unit tests
1 parent a6fc155 commit 204433b

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/com/danga/MemCached/test/UnitTests.java

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,74 +40,74 @@ public class UnitTests {
4040

4141
public static MemCachedClient mc = null;
4242

43-
public static void test1() throws Exception {
43+
public static void test1() {
4444
mc.set( "foo", Boolean.TRUE );
4545
Boolean b = (Boolean)mc.get( "foo" );
4646
assert b.booleanValue();
4747
}
4848

49-
public static void test2() throws Exception {
49+
public static void test2() {
5050
mc.set( "foo", new Integer( Integer.MAX_VALUE ) );
5151
Integer i = (Integer)mc.get( "foo" );
5252
assert i.intValue() == Integer.MAX_VALUE;
5353
}
5454

55-
public static void test3() throws Exception {
55+
public static void test3() {
5656
String input = "test of string encoding";
5757
mc.set( "foo", input );
5858
String s = (String)mc.get( "foo" );
5959
assert s.equals( input );
6060
}
6161

62-
public static void test4() throws Exception {
62+
public static void test4() {
6363
mc.set( "foo", new Character( 'z' ) );
6464
Character c = (Character)mc.get( "foo" );
6565
assert c.charValue() == 'z';
6666
}
6767

68-
public static void test5() throws Exception {
68+
public static void test5() {
6969
mc.set( "foo", new Byte( (byte)127 ) );
7070
Byte b = (Byte)mc.get( "foo" );
7171
assert b.byteValue() == 127;
7272
}
7373

74-
public static void test6() throws Exception {
74+
public static void test6() {
7575
mc.set( "foo", new StringBuffer( "hello" ) );
7676
StringBuffer o = (StringBuffer)mc.get( "foo" );
7777
assert o.toString().equals( "hello" );
7878
}
7979

80-
public static void test7() throws Exception {
80+
public static void test7() {
8181
mc.set( "foo", new Short( (short)100 ) );
8282
Short o = (Short)mc.get( "foo" );
8383
assert o.shortValue() == 100;
8484
}
8585

86-
public static void test8() throws Exception {
86+
public static void test8() {
8787
mc.set( "foo", new Long( Long.MAX_VALUE ) );
8888
Long o = (Long)mc.get( "foo" );
8989
assert o.longValue() == Long.MAX_VALUE;
9090
}
9191

92-
public static void test9() throws Exception {
92+
public static void test9() {
9393
mc.set( "foo", new Double( 1.1 ) );
9494
Double o = (Double)mc.get( "foo" );
9595
assert o.doubleValue() == 1.1;
9696
}
9797

98-
public static void test10() throws Exception {
98+
public static void test10() {
9999
mc.set( "foo", new Float( 1.1f ) );
100100
Float o = (Float)mc.get( "foo" );
101101
assert o.floatValue() == 1.1f;
102102
}
103103

104-
public static void test11() throws Exception {
104+
public static void test11() {
105105
mc.set( "foo", new Integer( 100 ), new Date( System.currentTimeMillis() ));
106106
Thread.sleep( 1000 );
107107
assert mc.get( "foo" ) != null;
108108
}
109109

110-
public static void test12() throws Exception {
110+
public static void test12() {
111111
long i = 0;
112112
mc.storeCounter("foo", i);
113113
mc.incr("foo"); // foo now == 1
@@ -117,12 +117,17 @@ public static void test12() throws Exception {
117117
assert j == mc.getCounter( "foo" );
118118
}
119119

120-
public static void test13() throws Exception {
120+
public static void test13() {
121121
Date d1 = new Date();
122122
mc.set("foo", d1);
123123
Date d2 = (Date) mc.get("foo");
124124
assert d.equals( d2 );
125125
}
126+
127+
public static void test14() {
128+
assert !mc.keyExists( "bar" );
129+
assert mc.keyExists( "foo" );
130+
}
126131

127132
/**
128133
* This runs through some simple tests of the MemCacheClient.
@@ -134,7 +139,7 @@ public static void test13() throws Exception {
134139
*
135140
* @param args the command line arguments
136141
*/
137-
public static void main(String[] args) throws Exception {
142+
public static void main(String[] args) {
138143

139144
String[] serverlist = { "192.168.1.1:1624" };
140145

@@ -160,5 +165,6 @@ public static void main(String[] args) throws Exception {
160165
test11();
161166
test12();
162167
test13();
168+
test14();
163169
}
164170
}

0 commit comments

Comments
 (0)