sebb 2005/07/20 13:39:23
Modified: src/junit/org/apache/jmeter/examples/junit
SampleTestCase2.java SampleTestCase.java
Log:
Fix tests so they can't run for more than 1 second each
Revision Changes Path
1.3 +2 -2
jakarta-jmeter/src/junit/org/apache/jmeter/examples/junit/SampleTestCase2.java
Index: SampleTestCase2.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/junit/org/apache/jmeter/examples/junit/SampleTestCase2.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SampleTestCase2.java 18 Jul 2005 00:11:12 -0000 1.2
+++ SampleTestCase2.java 20 Jul 2005 20:39:23 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,6 +55,6 @@
}
public int nextInt(){
- return RANDOM.nextInt();
+ return RANDOM.nextInt(1000);
}
}
1.4 +6 -6
jakarta-jmeter/src/junit/org/apache/jmeter/examples/junit/SampleTestCase.java
Index: SampleTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/junit/org/apache/jmeter/examples/junit/SampleTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SampleTestCase.java 18 Jul 2005 00:11:14 -0000 1.3
+++ SampleTestCase.java 20 Jul 2005 20:39:23 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 The Apache Software Foundation.
+ * Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@
}
public void testInt(){
- assertEquals(nextInt(),nextInt());
+ assertTrue(nextInt()!=nextInt());
}
public void testShort(){
@@ -59,9 +59,9 @@
}
public void testLong(){
- long time = nextLong();
+ long time = Math.abs(nextLong());
try {
- Thread.sleep(time);
+ Thread.sleep(time > 1000 ? 1000 : time);
} catch (InterruptedException e){
fail(e.getMessage());
}
@@ -86,11 +86,11 @@
}
public void setUp(){
- System.out.println("setUp");
+ //System.out.println("setUp");
}
public void tearDown(){
- System.out.println("tearDown");
+ //System.out.println("tearDown");
}
public int nextInt(){
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]