Clover Coverage Report - jmxmonitor 1.0.2
Coverage timestamp: Wed Feb 10 2010 07:36:51 GMT
8   61   5   2
2   31   0.62   4
4     1.25  
1    
 
  SimpleMBeanTest       Line # 31 8 0% 5 1 92.9% 0.9285714
 
  (1)
 
1    /*
2    * Copyright 2009 Ben Gidley
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16   
17    package uk.co.gidley.jmxmonitor.monitoring;
18   
19    import ch.qos.logback.classic.spi.ILoggingEvent;
20    import org.testng.annotations.Test;
21    import uk.co.gidley.jmxmonitor.uk.co.gidley.testAppender.TestAppender;
22   
23    import java.util.List;
24   
25    import static org.hamcrest.Matchers.equalTo;
26    import static org.hamcrest.MatcherAssert.assertThat;
27   
28    /**
29    * Created by IntelliJ IDEA. User: ben Date: Jan 8, 2010 Time: 4:16:06 PM
30    */
 
31    public class SimpleMBeanTest extends BaseMonitoringTest {
32   
 
33  1 toggle @Test
34    public void testMemoryMonitoring() {
35   
36  1 List<ILoggingEvent> events = TestAppender.getEvents();
37    // Find "Heap Used" message
38  1 boolean heapUsedFound = false;
39  1 for (ILoggingEvent event : events) {
40  1 if (event.getFormattedMessage().startsWith("Heap Used")) {
41  1 heapUsedFound = true;
42    }
43    }
44  1 assertThat(heapUsedFound, equalTo(true));
45    }
46   
 
47  1 toggle @Override
48    public String getConfiguration() {
49  1 return "src/test/resources/monitoring/simpleMBeanConfiguration.properties";
50    }
51   
 
52  1 toggle @Override
53    public int waitForEvents() {
54  1 return 1;
55    }
56   
 
57  1 toggle @Override
58    public void registerTestMBeans() {
59    //noop
60    }
61    }