comparison gwt-client/src/test/java/test/AbstractModuleRunner.java @ 9439:ce0a48b93f4b

bundu jUnit test first attempt
author gernotbelger
date Mon, 20 Aug 2018 16:57:25 +0200
parents da19f1f58d72
children e991c4cec0d0
comparison
equal deleted inserted replaced
9438:d2f5375ede26 9439:ce0a48b93f4b
316 316
317 } 317 }
318 318
319 protected final void makeKmRange(final double from, final double to, final String from_key, final String to_key) 319 protected final void makeKmRange(final double from, final double to, final String from_key, final String to_key)
320 throws ConnectionException, ServerException { 320 throws ConnectionException, ServerException {
321 final String fromStr = String.valueOf(from); 321 feedAndGo(makeFromToData(from_key, to_key), 0);
322 final String toStr = String.valueOf(to); 322 }
323
324 protected final Data[] makeFromToData(final String from_key, final String to_key) {
325 final String fromStr = String.valueOf(this.from);
326 final String toStr = String.valueOf(this.to);
323 final Data dataFrom = new StringOptionsData(from_key, from_key, new DataItem[] { new DefaultDataItem(fromStr, fromStr, fromStr) }); 327 final Data dataFrom = new StringOptionsData(from_key, from_key, new DataItem[] { new DefaultDataItem(fromStr, fromStr, fromStr) });
324 final Data dataTo = new StringOptionsData(to_key, to_key, new DataItem[] { new DefaultDataItem(toStr, toStr, toStr) }); 328 final Data dataTo = new StringOptionsData(to_key, to_key, new DataItem[] { new DefaultDataItem(toStr, toStr, toStr) });
325 final Data[] rangeFromToDetermined = new Data[] { dataFrom, dataTo }; 329 return new Data[] { dataFrom, dataTo };
326
327 feedAndGo(rangeFromToDetermined, 0);
328 } 330 }
329 331
330 protected final void selectRiver() throws ConnectionException, ServerException { 332 protected final void selectRiver() throws ConnectionException, ServerException {
331 final String riverStr = this.river.name(); 333 final String riverStr = this.river.name();
332 final Data data = new StringOptionsData("river", "river", new DataItem[] { new DefaultDataItem(riverStr, riverStr, riverStr) }); 334 final Data data = new StringOptionsData("river", "river", new DataItem[] { new DefaultDataItem(riverStr, riverStr, riverStr) });
352 throws ConnectionException, ServerException { 354 throws ConnectionException, ServerException {
353 355
354 return rec1.getRecommendationPairString(rec2, getCollection(), this.serverUrl, this.locale); 356 return rec1.getRecommendationPairString(rec2, getCollection(), this.serverUrl, this.locale);
355 } 357 }
356 358
357 protected final void feedSimpleTextInput(final String key, final String value) throws ConnectionException, ServerException { 359 protected final void feedAndGoData(final Data[] data) throws ConnectionException, ServerException {
358 final Data data = new StringOptionsData(key, key, new DataItem[] { new DefaultDataItem(value, value, value) }); 360 feedAndGo(data, 0);
359 feedAndGo(new Data[] { data }, 0); 361 }
362
363 protected final void feedAndGoSimpleTextInput(final String key, final String value) throws ConnectionException, ServerException {
364 feedAndGo(new Data[] { getSimpleTextInput(key, value) }, 0);
365 }
366
367 protected Data getSimpleTextInput(final String key, final String value) throws ConnectionException, ServerException {
368 return new StringOptionsData(key, key, new DataItem[] { new DefaultDataItem(value, value, value) });
369 }
370
371 protected final Data[] addItemToExistingData(final Data[] existing, final Data add) {
372 final Data[] data = new Data[existing.length + 1];
373 for (int i = 0; i < existing.length; i++) {
374 data[i] = existing[i];
375 }
376 data[existing.length] = add;
377 return data;
360 } 378 }
361 379
362 } 380 }

http://dive4elements.wald.intevation.org