1
1
/*
2
- * Copyright 2002-2007 the original author or authors.
2
+ * Copyright 2002-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
21
21
import org .springframework .mock .web .portlet .MockPortletRequest ;
22
22
import org .springframework .util .StopWatch ;
23
23
24
+ import static org .hamcrest .Matchers .*;
25
+ import static org .junit .Assert .*;
26
+
24
27
/**
25
28
* @author Juergen Hoeller
26
29
* @author Mark Fisher
@@ -370,8 +373,7 @@ public void testGetIntParameterWithDefaultValueHandlingIsFastEnough() {
370
373
PortletRequestUtils .getIntParameter (request , "nonExistingParam" , 0 );
371
374
}
372
375
sw .stop ();
373
- System .out .println (sw .getTotalTimeMillis ());
374
- assertTrue ("getStringParameter took too long: " + sw .getTotalTimeMillis (), sw .getTotalTimeMillis () < 250 );
376
+ assertThat (sw .getTotalTimeMillis (), lessThan (250L ));
375
377
}
376
378
377
379
public void testGetLongParameterWithDefaultValueHandlingIsFastEnough () {
@@ -382,8 +384,7 @@ public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {
382
384
PortletRequestUtils .getLongParameter (request , "nonExistingParam" , 0 );
383
385
}
384
386
sw .stop ();
385
- System .out .println (sw .getTotalTimeMillis ());
386
- assertTrue ("getStringParameter took too long: " + sw .getTotalTimeMillis (), sw .getTotalTimeMillis () < 250 );
387
+ assertThat (sw .getTotalTimeMillis (), lessThan (250L ));
387
388
}
388
389
389
390
public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough () {
@@ -394,8 +395,7 @@ public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {
394
395
PortletRequestUtils .getFloatParameter (request , "nonExistingParam" , 0f );
395
396
}
396
397
sw .stop ();
397
- System .out .println (sw .getTotalTimeMillis ());
398
- assertTrue ("getStringParameter took too long: " + sw .getTotalTimeMillis (), sw .getTotalTimeMillis () < 250 );
398
+ assertThat (sw .getTotalTimeMillis (), lessThan (250L ));
399
399
}
400
400
401
401
public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough () {
@@ -406,8 +406,7 @@ public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {
406
406
PortletRequestUtils .getDoubleParameter (request , "nonExistingParam" , 0d );
407
407
}
408
408
sw .stop ();
409
- System .out .println (sw .getTotalTimeMillis ());
410
- assertTrue ("getStringParameter took too long: " + sw .getTotalTimeMillis (), sw .getTotalTimeMillis () < 250 );
409
+ assertThat (sw .getTotalTimeMillis (), lessThan (250L ));
411
410
}
412
411
413
412
public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough () {
@@ -418,8 +417,7 @@ public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {
418
417
PortletRequestUtils .getBooleanParameter (request , "nonExistingParam" , false );
419
418
}
420
419
sw .stop ();
421
- System .out .println (sw .getTotalTimeMillis ());
422
- assertTrue ("getStringParameter took too long: " + sw .getTotalTimeMillis (), sw .getTotalTimeMillis () < 250 );
420
+ assertThat (sw .getTotalTimeMillis (), lessThan (250L ));
423
421
}
424
422
425
423
public void testGetStringParameterWithDefaultValueHandlingIsFastEnough () {
@@ -430,8 +428,7 @@ public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() {
430
428
PortletRequestUtils .getStringParameter (request , "nonExistingParam" , "defaultValue" );
431
429
}
432
430
sw .stop ();
433
- System .out .println (sw .getTotalTimeMillis ());
434
- assertTrue ("getStringParameter took too long: " + sw .getTotalTimeMillis (), sw .getTotalTimeMillis () < 250 );
431
+ assertThat (sw .getTotalTimeMillis (), lessThan (250L ));
435
432
}
436
433
437
434
}
0 commit comments