embulk-filter-row 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -1
- data/build.gradle +6 -1
- data/classpath/embulk-filter-row-0.2.1.jar +0 -0
- data/config/checkstyle/checkstyle.xml +127 -0
- data/example/example.csv +100 -0
- data/settings.gradle +1 -0
- data/src/main/java/org/embulk/filter/RowFilterPlugin.java +226 -115
- data/src/main/java/org/embulk/filter/row/BooleanCondition.java +16 -8
- data/src/main/java/org/embulk/filter/row/ConditionConfig.java +1 -1
- data/src/main/java/org/embulk/filter/row/ConditionFactory.java +20 -28
- data/src/main/java/org/embulk/filter/row/DoubleCondition.java +24 -12
- data/src/main/java/org/embulk/filter/row/LongCondition.java +31 -18
- data/src/main/java/org/embulk/filter/row/StringCondition.java +22 -11
- data/src/main/java/org/embulk/filter/row/TimestampCondition.java +24 -12
- data/src/test/java/org/embulk/filter/row/TestBooleanCondition.java +13 -7
- data/src/test/java/org/embulk/filter/row/TestConditionFactory.java +232 -95
- data/src/test/java/org/embulk/filter/row/TestDoubleCondition.java +44 -20
- data/src/test/java/org/embulk/filter/row/TestLongCondition.java +100 -27
- data/src/test/java/org/embulk/filter/row/TestStringCondition.java +36 -24
- data/src/test/java/org/embulk/filter/row/TestTimestampCondition.java +31 -21
- metadata +6 -3
- data/classpath/embulk-filter-row-0.2.0.jar +0 -0
@@ -1,43 +1,66 @@
|
|
1
1
|
package org.embulk.filter.row;
|
2
2
|
|
3
|
-
import
|
4
|
-
|
5
|
-
import static org.embulk.spi.type.Types.*;
|
6
|
-
import org.embulk.spi.type.BooleanType;
|
7
|
-
import org.embulk.spi.type.LongType;
|
8
|
-
import org.embulk.spi.type.DoubleType;
|
9
|
-
import org.embulk.spi.type.StringType;
|
10
|
-
import org.embulk.spi.type.TimestampType;
|
11
|
-
import org.embulk.spi.time.Timestamp;
|
3
|
+
import com.google.common.base.Optional;
|
4
|
+
|
12
5
|
import org.embulk.config.ConfigException;
|
13
6
|
import org.embulk.config.TaskSource;
|
7
|
+
import org.embulk.spi.Column;
|
14
8
|
|
15
|
-
import org.embulk.filter.row.ConditionConfig;
|
16
|
-
import org.embulk.filter.row.ConditionFactory;
|
17
|
-
import org.embulk.filter.row.BooleanCondition;
|
18
|
-
import org.embulk.filter.row.DoubleCondition;
|
19
|
-
import org.embulk.filter.row.Condition;
|
20
|
-
import org.embulk.filter.row.StringCondition;
|
21
|
-
import org.embulk.filter.row.TimestampCondition;
|
22
|
-
|
23
|
-
import com.google.common.base.Optional;
|
24
9
|
import org.jruby.embed.ScriptingContainer;
|
25
10
|
import org.junit.Test;
|
26
|
-
|
27
|
-
import
|
11
|
+
|
12
|
+
import static org.embulk.spi.type.Types.BOOLEAN;
|
13
|
+
import static org.embulk.spi.type.Types.DOUBLE;
|
14
|
+
import static org.embulk.spi.type.Types.LONG;
|
15
|
+
import static org.embulk.spi.type.Types.STRING;
|
16
|
+
import static org.embulk.spi.type.Types.TIMESTAMP;
|
17
|
+
|
18
|
+
//import static org.junit.Assert.assertFalse;
|
19
|
+
import static org.junit.Assert.assertTrue;
|
20
|
+
import static org.junit.Assert.fail;
|
28
21
|
|
29
22
|
public class TestConditionFactory
|
30
23
|
{
|
31
24
|
public class DefaultConditionConfig implements ConditionConfig
|
32
25
|
{
|
33
|
-
public String getColumn()
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
public Optional<String>
|
39
|
-
|
40
|
-
|
26
|
+
public String getColumn()
|
27
|
+
{
|
28
|
+
return "column";
|
29
|
+
}
|
30
|
+
|
31
|
+
public Optional<String> getOperator()
|
32
|
+
{
|
33
|
+
return Optional.of("IS NULL");
|
34
|
+
}
|
35
|
+
|
36
|
+
public Optional<Object> getArgument()
|
37
|
+
{
|
38
|
+
return Optional.absent();
|
39
|
+
}
|
40
|
+
|
41
|
+
public Optional<Boolean> getNot()
|
42
|
+
{
|
43
|
+
return Optional.of(false);
|
44
|
+
}
|
45
|
+
|
46
|
+
public Optional<String> getFormat()
|
47
|
+
{
|
48
|
+
return Optional.of("%Y-%m-%d");
|
49
|
+
}
|
50
|
+
|
51
|
+
public Optional<String> getTimezone()
|
52
|
+
{
|
53
|
+
return Optional.of("UTC");
|
54
|
+
}
|
55
|
+
|
56
|
+
public TaskSource dump()
|
57
|
+
{
|
58
|
+
return null;
|
59
|
+
}
|
60
|
+
|
61
|
+
public void validate()
|
62
|
+
{
|
63
|
+
}
|
41
64
|
}
|
42
65
|
|
43
66
|
private final ScriptingContainer jruby;
|
@@ -48,185 +71,292 @@ public class TestConditionFactory
|
|
48
71
|
}
|
49
72
|
|
50
73
|
@Test
|
51
|
-
public void testCreateBooleanCondition()
|
74
|
+
public void testCreateBooleanCondition()
|
75
|
+
{
|
52
76
|
Column column = new Column(0, "column", BOOLEAN);
|
53
77
|
ConditionConfig config;
|
54
78
|
BooleanCondition condition;
|
55
79
|
|
56
80
|
config = new DefaultConditionConfig() {
|
57
|
-
public Optional<String> getOperator()
|
81
|
+
public Optional<String> getOperator()
|
82
|
+
{
|
83
|
+
return Optional.of("IS NULL");
|
84
|
+
}
|
58
85
|
};
|
59
|
-
condition = (BooleanCondition)new ConditionFactory(jruby, column, config).createCondition();
|
86
|
+
condition = (BooleanCondition) new ConditionFactory(jruby, column, config).createCondition();
|
60
87
|
assertTrue(condition.compare(null));
|
61
88
|
|
62
89
|
config = new DefaultConditionConfig() {
|
63
|
-
public Optional<String> getOperator()
|
64
|
-
|
90
|
+
public Optional<String> getOperator()
|
91
|
+
{
|
92
|
+
return Optional.of("==");
|
93
|
+
}
|
94
|
+
public Optional<Object> getArgument()
|
95
|
+
{
|
96
|
+
return Optional.absent();
|
97
|
+
}
|
65
98
|
};
|
66
99
|
try {
|
67
|
-
condition = (BooleanCondition)new ConditionFactory(jruby, column, config).createCondition();
|
100
|
+
condition = (BooleanCondition) new ConditionFactory(jruby, column, config).createCondition();
|
68
101
|
fail("Argument is required");
|
69
|
-
}
|
102
|
+
}
|
103
|
+
catch (ConfigException e) {
|
70
104
|
}
|
71
105
|
|
72
106
|
config = new DefaultConditionConfig() {
|
73
|
-
public Optional<String> getOperator()
|
74
|
-
|
107
|
+
public Optional<String> getOperator()
|
108
|
+
{
|
109
|
+
return Optional.of("==");
|
110
|
+
}
|
111
|
+
public Optional<Object> getArgument()
|
112
|
+
{
|
113
|
+
return Optional.of((Object) new Boolean(true));
|
114
|
+
}
|
75
115
|
};
|
76
|
-
condition = (BooleanCondition)new ConditionFactory(jruby, column, config).createCondition();
|
116
|
+
condition = (BooleanCondition) new ConditionFactory(jruby, column, config).createCondition();
|
77
117
|
assertTrue(condition.compare(new Boolean(true)));
|
78
118
|
|
79
119
|
config = new DefaultConditionConfig() {
|
80
|
-
public Optional<String> getOperator()
|
81
|
-
|
120
|
+
public Optional<String> getOperator()
|
121
|
+
{
|
122
|
+
return Optional.of("==");
|
123
|
+
}
|
124
|
+
public Optional<Object> getArgument()
|
125
|
+
{
|
126
|
+
return Optional.of((Object) new Long(10));
|
127
|
+
}
|
82
128
|
};
|
83
129
|
try {
|
84
|
-
condition = (BooleanCondition)new ConditionFactory(jruby, column, config).createCondition();
|
130
|
+
condition = (BooleanCondition) new ConditionFactory(jruby, column, config).createCondition();
|
85
131
|
fail("Argument type mismatch");
|
86
|
-
}
|
132
|
+
}
|
133
|
+
catch (ConfigException e) {
|
87
134
|
}
|
88
135
|
}
|
89
136
|
|
90
137
|
@Test
|
91
|
-
public void testCreateDoubleCondition()
|
138
|
+
public void testCreateDoubleCondition()
|
139
|
+
{
|
92
140
|
Column column = new Column(0, "column", DOUBLE);
|
93
141
|
ConditionConfig config;
|
94
142
|
DoubleCondition condition;
|
95
143
|
|
96
144
|
config = new DefaultConditionConfig() {
|
97
|
-
public Optional<String> getOperator()
|
145
|
+
public Optional<String> getOperator()
|
146
|
+
{
|
147
|
+
return Optional.of("IS NULL");
|
148
|
+
}
|
98
149
|
};
|
99
|
-
condition = (DoubleCondition)new ConditionFactory(jruby, column, config).createCondition();
|
150
|
+
condition = (DoubleCondition) new ConditionFactory(jruby, column, config).createCondition();
|
100
151
|
assertTrue(condition.compare(null));
|
101
152
|
|
102
153
|
config = new DefaultConditionConfig() {
|
103
|
-
public Optional<String> getOperator()
|
104
|
-
|
154
|
+
public Optional<String> getOperator()
|
155
|
+
{
|
156
|
+
return Optional.of("==");
|
157
|
+
}
|
158
|
+
public Optional<Object> getArgument()
|
159
|
+
{
|
160
|
+
return Optional.absent();
|
161
|
+
}
|
105
162
|
};
|
106
163
|
try {
|
107
|
-
condition = (DoubleCondition)new ConditionFactory(jruby, column, config).createCondition();
|
164
|
+
condition = (DoubleCondition) new ConditionFactory(jruby, column, config).createCondition();
|
108
165
|
fail("Argument is required");
|
109
|
-
}
|
166
|
+
}
|
167
|
+
catch (ConfigException e) {
|
110
168
|
}
|
111
169
|
|
112
170
|
config = new DefaultConditionConfig() {
|
113
|
-
public Optional<String> getOperator()
|
114
|
-
|
171
|
+
public Optional<String> getOperator()
|
172
|
+
{
|
173
|
+
return Optional.of("==");
|
174
|
+
}
|
175
|
+
public Optional<Object> getArgument()
|
176
|
+
{
|
177
|
+
return Optional.of((Object) new Double(10));
|
178
|
+
}
|
115
179
|
};
|
116
|
-
condition = (DoubleCondition)new ConditionFactory(jruby, column, config).createCondition();
|
180
|
+
condition = (DoubleCondition) new ConditionFactory(jruby, column, config).createCondition();
|
117
181
|
assertTrue(condition.compare(new Double(10)));
|
118
182
|
|
119
183
|
config = new DefaultConditionConfig() {
|
120
|
-
public Optional<String> getOperator()
|
121
|
-
|
184
|
+
public Optional<String> getOperator()
|
185
|
+
{
|
186
|
+
return Optional.of("==");
|
187
|
+
}
|
188
|
+
public Optional<Object> getArgument()
|
189
|
+
{
|
190
|
+
return Optional.of((Object) new Boolean(true));
|
191
|
+
}
|
122
192
|
};
|
123
193
|
try {
|
124
|
-
condition = (DoubleCondition)new ConditionFactory(jruby, column, config).createCondition();
|
194
|
+
condition = (DoubleCondition) new ConditionFactory(jruby, column, config).createCondition();
|
125
195
|
fail("Argument type mismatch");
|
126
|
-
}
|
196
|
+
}
|
197
|
+
catch (ConfigException e) {
|
127
198
|
}
|
128
199
|
}
|
129
200
|
|
130
201
|
@Test
|
131
|
-
public void testCreateLongCondition()
|
202
|
+
public void testCreateLongCondition()
|
203
|
+
{
|
132
204
|
Column column = new Column(0, "column", LONG);
|
133
205
|
ConditionConfig config;
|
134
206
|
LongCondition condition;
|
135
207
|
|
136
208
|
config = new DefaultConditionConfig() {
|
137
|
-
public Optional<String> getOperator()
|
209
|
+
public Optional<String> getOperator()
|
210
|
+
{
|
211
|
+
return Optional.of("IS NULL");
|
212
|
+
}
|
138
213
|
};
|
139
|
-
condition = (LongCondition)new ConditionFactory(jruby, column, config).createCondition();
|
214
|
+
condition = (LongCondition) new ConditionFactory(jruby, column, config).createCondition();
|
140
215
|
assertTrue(condition.compare(null));
|
141
216
|
|
142
217
|
config = new DefaultConditionConfig() {
|
143
|
-
public Optional<String> getOperator()
|
144
|
-
|
218
|
+
public Optional<String> getOperator()
|
219
|
+
{
|
220
|
+
return Optional.of("==");
|
221
|
+
}
|
222
|
+
public Optional<Object> getArgument()
|
223
|
+
{
|
224
|
+
return Optional.absent();
|
225
|
+
}
|
145
226
|
};
|
146
227
|
try {
|
147
|
-
condition = (LongCondition)new ConditionFactory(jruby, column, config).createCondition();
|
228
|
+
condition = (LongCondition) new ConditionFactory(jruby, column, config).createCondition();
|
148
229
|
fail("Argument is required");
|
149
|
-
}
|
230
|
+
}
|
231
|
+
catch (ConfigException e) {
|
150
232
|
}
|
151
233
|
|
152
234
|
config = new DefaultConditionConfig() {
|
153
|
-
public Optional<String> getOperator()
|
154
|
-
|
235
|
+
public Optional<String> getOperator()
|
236
|
+
{
|
237
|
+
return Optional.of("==");
|
238
|
+
}
|
239
|
+
public Optional<Object> getArgument()
|
240
|
+
{
|
241
|
+
return Optional.of((Object) new Long(10));
|
242
|
+
}
|
155
243
|
};
|
156
|
-
condition = (LongCondition)new ConditionFactory(jruby, column, config).createCondition();
|
244
|
+
condition = (LongCondition) new ConditionFactory(jruby, column, config).createCondition();
|
157
245
|
assertTrue(condition.compare(new Long(10)));
|
158
246
|
|
159
247
|
config = new DefaultConditionConfig() {
|
160
|
-
public Optional<String> getOperator()
|
161
|
-
|
248
|
+
public Optional<String> getOperator()
|
249
|
+
{
|
250
|
+
return Optional.of("==");
|
251
|
+
}
|
252
|
+
public Optional<Object> getArgument()
|
253
|
+
{
|
254
|
+
return Optional.of((Object) new Boolean(true));
|
255
|
+
}
|
162
256
|
};
|
163
257
|
try {
|
164
|
-
condition = (LongCondition)new ConditionFactory(jruby, column, config).createCondition();
|
258
|
+
condition = (LongCondition) new ConditionFactory(jruby, column, config).createCondition();
|
165
259
|
fail("Argument type mismatch");
|
166
|
-
}
|
260
|
+
}
|
261
|
+
catch (ConfigException e) {
|
167
262
|
}
|
168
263
|
}
|
169
264
|
|
170
265
|
@Test
|
171
|
-
public void testCreateStringCondition()
|
266
|
+
public void testCreateStringCondition()
|
267
|
+
{
|
172
268
|
Column column = new Column(0, "column", STRING);
|
173
269
|
ConditionConfig config;
|
174
270
|
StringCondition condition;
|
175
271
|
|
176
272
|
config = new DefaultConditionConfig() {
|
177
|
-
public Optional<String> getOperator()
|
273
|
+
public Optional<String> getOperator()
|
274
|
+
{
|
275
|
+
return Optional.of("IS NULL");
|
276
|
+
}
|
178
277
|
};
|
179
|
-
condition = (StringCondition)new ConditionFactory(jruby, column, config).createCondition();
|
278
|
+
condition = (StringCondition) new ConditionFactory(jruby, column, config).createCondition();
|
180
279
|
assertTrue(condition.compare(null));
|
181
280
|
|
182
281
|
config = new DefaultConditionConfig() {
|
183
|
-
public Optional<String> getOperator()
|
184
|
-
|
282
|
+
public Optional<String> getOperator()
|
283
|
+
{
|
284
|
+
return Optional.of("==");
|
285
|
+
}
|
286
|
+
public Optional<Object> getArgument()
|
287
|
+
{
|
288
|
+
return Optional.absent();
|
289
|
+
}
|
185
290
|
};
|
186
291
|
try {
|
187
|
-
condition = (StringCondition)new ConditionFactory(jruby, column, config).createCondition();
|
292
|
+
condition = (StringCondition) new ConditionFactory(jruby, column, config).createCondition();
|
188
293
|
fail("Argument is required");
|
189
|
-
}
|
294
|
+
}
|
295
|
+
catch (ConfigException e) {
|
190
296
|
}
|
191
297
|
|
192
298
|
config = new DefaultConditionConfig() {
|
193
|
-
public Optional<String> getOperator()
|
194
|
-
|
299
|
+
public Optional<String> getOperator()
|
300
|
+
{
|
301
|
+
return Optional.of("==");
|
302
|
+
}
|
303
|
+
public Optional<Object> getArgument()
|
304
|
+
{
|
305
|
+
return Optional.of((Object) "foo");
|
306
|
+
}
|
195
307
|
};
|
196
|
-
condition = (StringCondition)new ConditionFactory(jruby, column, config).createCondition();
|
308
|
+
condition = (StringCondition) new ConditionFactory(jruby, column, config).createCondition();
|
197
309
|
assertTrue(condition.compare("foo"));
|
198
310
|
|
199
311
|
config = new DefaultConditionConfig() {
|
200
|
-
public Optional<String> getOperator()
|
201
|
-
|
312
|
+
public Optional<String> getOperator()
|
313
|
+
{
|
314
|
+
return Optional.of("==");
|
315
|
+
}
|
316
|
+
public Optional<Object> getArgument()
|
317
|
+
{
|
318
|
+
return Optional.of((Object) new Boolean(true));
|
319
|
+
}
|
202
320
|
};
|
203
321
|
try {
|
204
|
-
condition = (StringCondition)new ConditionFactory(jruby, column, config).createCondition();
|
322
|
+
condition = (StringCondition) new ConditionFactory(jruby, column, config).createCondition();
|
205
323
|
fail("Argument type mismatch");
|
206
|
-
}
|
324
|
+
}
|
325
|
+
catch (ConfigException e) {
|
207
326
|
}
|
208
327
|
}
|
209
328
|
|
210
329
|
@Test
|
211
|
-
public void testCreateTimestampCondition()
|
330
|
+
public void testCreateTimestampCondition()
|
331
|
+
{
|
212
332
|
Column column = new Column(0, "column", TIMESTAMP);
|
213
333
|
ConditionConfig config;
|
214
334
|
TimestampCondition condition;
|
215
335
|
|
216
336
|
config = new DefaultConditionConfig() {
|
217
|
-
public Optional<String> getOperator()
|
337
|
+
public Optional<String> getOperator()
|
338
|
+
{
|
339
|
+
return Optional.of("IS NULL");
|
340
|
+
}
|
218
341
|
};
|
219
|
-
condition = (TimestampCondition)new ConditionFactory(jruby, column, config).createCondition();
|
342
|
+
condition = (TimestampCondition) new ConditionFactory(jruby, column, config).createCondition();
|
220
343
|
assertTrue(condition.compare(null));
|
221
344
|
|
222
345
|
config = new DefaultConditionConfig() {
|
223
|
-
public Optional<String> getOperator()
|
224
|
-
|
346
|
+
public Optional<String> getOperator()
|
347
|
+
{
|
348
|
+
return Optional.of("==");
|
349
|
+
}
|
350
|
+
public Optional<Object> getArgument()
|
351
|
+
{
|
352
|
+
return Optional.absent();
|
353
|
+
}
|
225
354
|
};
|
226
355
|
try {
|
227
|
-
condition = (TimestampCondition)new ConditionFactory(jruby, column, config).createCondition();
|
356
|
+
condition = (TimestampCondition) new ConditionFactory(jruby, column, config).createCondition();
|
228
357
|
fail("Argument is required");
|
229
|
-
}
|
358
|
+
}
|
359
|
+
catch (ConfigException e) {
|
230
360
|
}
|
231
361
|
|
232
362
|
//ToDo: How to create jruby object correctly?
|
@@ -238,13 +368,20 @@ public class TestConditionFactory
|
|
238
368
|
//condition = (TimestampCondition)new ConditionFactory(jruby, column, config).createCondition();
|
239
369
|
|
240
370
|
config = new DefaultConditionConfig() {
|
241
|
-
public Optional<String> getOperator()
|
242
|
-
|
371
|
+
public Optional<String> getOperator()
|
372
|
+
{
|
373
|
+
return Optional.of("==");
|
374
|
+
}
|
375
|
+
public Optional<Object> getArgument()
|
376
|
+
{
|
377
|
+
return Optional.of((Object) new Boolean(true));
|
378
|
+
}
|
243
379
|
};
|
244
380
|
try {
|
245
|
-
condition = (TimestampCondition)new ConditionFactory(jruby, column, config).createCondition();
|
381
|
+
condition = (TimestampCondition) new ConditionFactory(jruby, column, config).createCondition();
|
246
382
|
fail("Argument type mismatch");
|
247
|
-
}
|
383
|
+
}
|
384
|
+
catch (ConfigException e) {
|
248
385
|
}
|
249
386
|
}
|
250
387
|
}
|
@@ -1,81 +1,105 @@
|
|
1
1
|
package org.embulk.filter.row;
|
2
2
|
|
3
|
-
import org.embulk.filter.row.DoubleCondition;
|
4
3
|
import org.junit.Test;
|
5
|
-
|
4
|
+
|
5
|
+
import static org.junit.Assert.assertFalse;
|
6
|
+
import static org.junit.Assert.assertTrue;
|
6
7
|
|
7
8
|
public class TestDoubleCondition
|
8
9
|
{
|
9
10
|
@Test
|
10
|
-
public void testIsNull()
|
11
|
+
public void testIsNull()
|
12
|
+
{
|
11
13
|
DoubleCondition condition = new DoubleCondition("IS NULL", null, false);
|
12
14
|
assertTrue(condition.compare(null));
|
13
15
|
assertFalse(condition.compare(new Double(10)));
|
14
16
|
}
|
15
17
|
|
16
18
|
@Test
|
17
|
-
public void testIsNotNull()
|
19
|
+
public void testIsNotNull()
|
20
|
+
{
|
18
21
|
DoubleCondition condition = new DoubleCondition("IS NOT NULL", null, false);
|
19
22
|
assertFalse(condition.compare(null));
|
20
23
|
assertTrue(condition.compare(new Double(10)));
|
21
24
|
}
|
22
25
|
|
23
26
|
@Test
|
24
|
-
public void testEquals()
|
27
|
+
public void testEquals()
|
28
|
+
{
|
25
29
|
DoubleCondition condition = new DoubleCondition("==", new Double(10), false);
|
26
30
|
assertFalse(condition.compare(null));
|
27
|
-
assertTrue(
|
31
|
+
assertTrue(condition.compare(new Double(10)));
|
28
32
|
assertFalse(condition.compare(new Double(11)));
|
33
|
+
assertTrue(condition.compare(new Double(10.0)));
|
34
|
+
assertFalse(condition.compare(new Double(11.0)));
|
29
35
|
|
30
36
|
// Prohibited by Factory
|
31
37
|
// DoubleCondition condition = new DoubleCondition("==", null, false);
|
32
38
|
}
|
33
39
|
|
34
40
|
@Test
|
35
|
-
public void testNotEquals()
|
41
|
+
public void testNotEquals()
|
42
|
+
{
|
36
43
|
DoubleCondition condition = new DoubleCondition("!=", new Double(10), false);
|
37
|
-
assertTrue(
|
44
|
+
assertTrue(condition.compare(null));
|
38
45
|
assertFalse(condition.compare(new Double(10)));
|
39
|
-
assertTrue(
|
46
|
+
assertTrue(condition.compare(new Double(11)));
|
47
|
+
assertFalse(condition.compare(new Double(10.0)));
|
48
|
+
assertTrue(condition.compare(new Double(11.0)));
|
40
49
|
}
|
41
50
|
|
42
51
|
@Test
|
43
|
-
public void testGreaterThan()
|
52
|
+
public void testGreaterThan()
|
53
|
+
{
|
44
54
|
DoubleCondition condition = new DoubleCondition(">", new Double(10), false);
|
45
55
|
assertFalse(condition.compare(null));
|
46
56
|
assertFalse(condition.compare(new Double(10)));
|
47
|
-
assertTrue(
|
57
|
+
assertTrue(condition.compare(new Double(11)));
|
58
|
+
assertFalse(condition.compare(new Double(10.0)));
|
59
|
+
assertTrue(condition.compare(new Double(11.0)));
|
48
60
|
}
|
49
61
|
|
50
62
|
@Test
|
51
|
-
public void testGreaterEqual()
|
63
|
+
public void testGreaterEqual()
|
64
|
+
{
|
52
65
|
DoubleCondition condition = new DoubleCondition(">=", new Double(11), false);
|
53
66
|
assertFalse(condition.compare(null));
|
54
67
|
assertFalse(condition.compare(new Double(10)));
|
55
|
-
assertTrue(
|
68
|
+
assertTrue(condition.compare(new Double(11)));
|
69
|
+
assertFalse(condition.compare(new Double(10.0)));
|
70
|
+
assertTrue(condition.compare(new Double(11.0)));
|
56
71
|
}
|
57
72
|
|
58
73
|
@Test
|
59
|
-
public void testLessThan()
|
74
|
+
public void testLessThan()
|
75
|
+
{
|
60
76
|
DoubleCondition condition = new DoubleCondition("<", new Double(11), false);
|
61
77
|
assertFalse(condition.compare(null));
|
62
78
|
assertFalse(condition.compare(new Double(11)));
|
63
|
-
assertTrue(
|
79
|
+
assertTrue(condition.compare(new Double(10)));
|
80
|
+
assertFalse(condition.compare(new Double(11.0)));
|
81
|
+
assertTrue(condition.compare(new Double(10.0)));
|
64
82
|
}
|
65
83
|
|
66
84
|
@Test
|
67
|
-
public void testLessEqual()
|
85
|
+
public void testLessEqual()
|
86
|
+
{
|
68
87
|
DoubleCondition condition = new DoubleCondition("<=", new Double(11), false);
|
69
88
|
assertFalse(condition.compare(null));
|
70
89
|
assertFalse(condition.compare(new Double(12)));
|
71
|
-
assertTrue(
|
90
|
+
assertTrue(condition.compare(new Double(11)));
|
91
|
+
assertFalse(condition.compare(new Double(12.0)));
|
92
|
+
assertTrue(condition.compare(new Double(11.0)));
|
72
93
|
}
|
73
94
|
|
74
95
|
@Test
|
75
|
-
public void testNot()
|
96
|
+
public void testNot()
|
97
|
+
{
|
76
98
|
DoubleCondition condition = new DoubleCondition("<=", new Double(11), true);
|
77
|
-
assertTrue(
|
78
|
-
assertTrue(
|
99
|
+
assertTrue(condition.compare(null));
|
100
|
+
assertTrue(condition.compare(new Double(12)));
|
79
101
|
assertFalse(condition.compare(new Double(11)));
|
102
|
+
assertTrue(condition.compare(new Double(12.0)));
|
103
|
+
assertFalse(condition.compare(new Double(11.0)));
|
80
104
|
}
|
81
105
|
}
|