1 32 33 package com.jeantessier.metrics; 34 35 import junit.framework.*; 36 37 public class TestNullMeasurement extends TestCase implements MeasurementVisitor { 38 private NullMeasurement measurement; 39 private Measurement visited; 40 41 protected void setUp() { 42 measurement = new NullMeasurement(); 43 } 44 45 public void testMeasurementDescriptor() throws Exception { 46 assertNull(measurement.getDescriptor()); 47 assertNull(measurement.getShortName()); 48 assertNull(measurement.getLongName()); 49 } 50 51 public void testAdd() { 52 measurement.add(null); 53 measurement.add(new Object ()); 54 measurement.add(measurement); 55 } 56 57 public void testEmpty() { 58 assertTrue("Before Add()", measurement.isEmpty()); 59 60 measurement.add(new Object ()); 61 62 assertTrue("After Add()", measurement.isEmpty()); 63 } 64 65 public void testAccept() { 66 visited = null; 67 measurement.accept(this); 68 assertNull(visited); 69 } 70 71 public void visitStatisticalMeasurement(StatisticalMeasurement measurement) { 72 visited = measurement; 73 } 74 75 public void visitRatioMeasurement(RatioMeasurement measurement) { 76 visited = measurement; 77 } 78 79 public void visitNbSubMetricsMeasurement(NbSubMetricsMeasurement measurement) { 80 visited = measurement; 81 } 82 83 public void visitCounterMeasurement(CounterMeasurement measurement) { 84 visited = measurement; 85 } 86 87 public void visitContextAccumulatorMeasurement(ContextAccumulatorMeasurement measurement) { 88 } 90 91 public void visitNameListMeasurement(NameListMeasurement measurement) { 92 } 94 95 public void visitSubMetricsAccumulatorMeasurement(SubMetricsAccumulatorMeasurement measurement) { 96 } 98 99 public void visitSumMeasurement(SumMeasurement measurement) { 100 visited = measurement; 101 } 102 } 103 | Popular Tags |