|
26 | 26 | import static org.junit.Assert.assertNull;
|
27 | 27 | import static org.junit.Assert.assertTrue;
|
28 | 28 | import static org.junit.Assert.fail;
|
| 29 | + |
29 | 30 | import static org.mockito.Matchers.anyString;
|
30 | 31 | import static org.mockito.Mockito.times;
|
31 | 32 | import static org.mockito.Mockito.verify;
|
@@ -65,13 +66,94 @@ public final class TestGraphHandler {
|
65 | 66 | }
|
66 | 67 |
|
67 | 68 | @Test
|
68 |
| - public void setPlotParams() throws Exception { |
| 69 | + public void setYRangeParams() throws Exception { |
69 | 70 | Plot plot = mock(Plot.class);
|
70 | 71 | HttpQuery query = mock(HttpQuery.class);
|
71 | 72 | Map<String, List<String>> params = Maps.newHashMap();
|
72 | 73 | when(query.getQueryString()).thenReturn(params);
|
| 74 | + |
| 75 | + params.put("yrange", Lists.newArrayList("[0:1]")); |
| 76 | + GraphHandler.setPlotParams(query, plot); |
| 77 | + |
| 78 | + params.put("yrange", Lists.newArrayList("[:]")); |
| 79 | + GraphHandler.setPlotParams(query, plot); |
| 80 | + |
| 81 | + params.put("yrange", Lists.newArrayList("[:0]")); |
| 82 | + GraphHandler.setPlotParams(query, plot); |
| 83 | + |
| 84 | + params.put("yrange", Lists.newArrayList("[:42]")); |
| 85 | + GraphHandler.setPlotParams(query, plot); |
| 86 | + |
| 87 | + params.put("yrange", Lists.newArrayList("[:-42]")); |
| 88 | + GraphHandler.setPlotParams(query, plot); |
| 89 | + |
| 90 | + params.put("yrange", Lists.newArrayList("[:0.8]")); |
| 91 | + GraphHandler.setPlotParams(query, plot); |
| 92 | + |
| 93 | + params.put("yrange", Lists.newArrayList("[:-0.8]")); |
| 94 | + GraphHandler.setPlotParams(query, plot); |
| 95 | + |
| 96 | + params.put("yrange", Lists.newArrayList("[:42.4]")); |
| 97 | + GraphHandler.setPlotParams(query, plot); |
| 98 | + |
| 99 | + params.put("yrange", Lists.newArrayList("[:-42.4]")); |
| 100 | + GraphHandler.setPlotParams(query, plot); |
| 101 | + |
| 102 | + params.put("yrange", Lists.newArrayList("[:4e4]")); |
| 103 | + GraphHandler.setPlotParams(query, plot); |
| 104 | + |
| 105 | + params.put("yrange", Lists.newArrayList("[:-4e4]")); |
| 106 | + GraphHandler.setPlotParams(query, plot); |
| 107 | + |
| 108 | + params.put("yrange", Lists.newArrayList("[:4e-4]")); |
| 109 | + GraphHandler.setPlotParams(query, plot); |
| 110 | + |
| 111 | + params.put("yrange", Lists.newArrayList("[:-4e-4]")); |
| 112 | + GraphHandler.setPlotParams(query, plot); |
| 113 | + |
| 114 | + params.put("yrange", Lists.newArrayList("[:4.2e4]")); |
| 115 | + GraphHandler.setPlotParams(query, plot); |
| 116 | + |
| 117 | + params.put("yrange", Lists.newArrayList("[:-4.2e4]")); |
| 118 | + GraphHandler.setPlotParams(query, plot); |
| 119 | + |
| 120 | + params.put("yrange", Lists.newArrayList("[0:]")); |
| 121 | + GraphHandler.setPlotParams(query, plot); |
| 122 | + |
| 123 | + params.put("yrange", Lists.newArrayList("[5:]")); |
| 124 | + GraphHandler.setPlotParams(query, plot); |
| 125 | + |
| 126 | + params.put("yrange", Lists.newArrayList("[-5:]")); |
| 127 | + GraphHandler.setPlotParams(query, plot); |
| 128 | + |
| 129 | + params.put("yrange", Lists.newArrayList("[0.5:]")); |
| 130 | + GraphHandler.setPlotParams(query, plot); |
| 131 | + |
| 132 | + params.put("yrange", Lists.newArrayList("[-0.5:]")); |
| 133 | + GraphHandler.setPlotParams(query, plot); |
| 134 | + |
| 135 | + params.put("yrange", Lists.newArrayList("[10.5:]")); |
| 136 | + GraphHandler.setPlotParams(query, plot); |
| 137 | + |
| 138 | + params.put("yrange", Lists.newArrayList("[-10.5:]")); |
| 139 | + GraphHandler.setPlotParams(query, plot); |
| 140 | + |
| 141 | + params.put("yrange", Lists.newArrayList("[10e5:]")); |
| 142 | + GraphHandler.setPlotParams(query, plot); |
| 143 | + |
| 144 | + params.put("yrange", Lists.newArrayList("[-10e5:]")); |
| 145 | + GraphHandler.setPlotParams(query, plot); |
| 146 | + |
| 147 | + params.put("yrange", Lists.newArrayList("[10e-5:]")); |
| 148 | + GraphHandler.setPlotParams(query, plot); |
| 149 | + |
| 150 | + params.put("yrange", Lists.newArrayList("[-10e-5:]")); |
| 151 | + GraphHandler.setPlotParams(query, plot); |
| 152 | + |
| 153 | + params.put("yrange", Lists.newArrayList("[10.1e-5:]")); |
| 154 | + GraphHandler.setPlotParams(query, plot); |
73 | 155 |
|
74 |
| - params.put("yrange", Lists.newArrayList("[0:42]")); |
| 156 | + params.put("yrange", Lists.newArrayList("[-10.1e-5:]")); |
75 | 157 | GraphHandler.setPlotParams(query, plot);
|
76 | 158 |
|
77 | 159 | params.put("yrange", Lists.newArrayList("[33:system('touch /tmp/poc.txt')]"));
|
|
0 commit comments