375 .orElseThrow(() -> new RuntimeException(
376 "[Cannot find application name inside "
377 + ext + " entry inside " + CLASSES
378 + "]"));
379 return CLASSES + "\\" + m.group(1);
380 }
381 }
382
383 try {
384 File oneOfIcons = null;
385 String extension = null;
386
387 @SuppressWarnings("unchecked")
388 List<Map<String, Object>> associations = (List<Map<String, Object>>) value;
389 final String CLASSES = "HKEY_CURRENT_USER\\Software\\Classes";
390 for (Map<String, Object> association : associations) {
391 // get expected data
392 @SuppressWarnings("unchecked")
393 List<String> extensions = (List<String>) association
394 .get(FA_EXTENSIONS);
395 File icon = (File) association.get(FA_ICON);
396
397 // check association of extension with our application name
398 for (String ext : extensions) {
399
400 Registry.QueryBuilder builder = Registry
401 .getQueryBuilder();
402 builder.key(CLASSES).useDataPattern(ext);
403 Registry.Query query = builder.build();
404 Optional<List<String>> output = query.execute();
405
406 final Predicate<? super String> predicate = str -> str
407 .trim().contains("." + ext);
408 boolean menuItemExists = output
409 .orElse(Collections.emptyList()).stream()
410 .anyMatch(predicate);
411
412 assertTrue(menuItemExists, "[Extension " + ext
413 + " not found in registry " + CLASSES + " ]");
414 }
|
375 .orElseThrow(() -> new RuntimeException(
376 "[Cannot find application name inside "
377 + ext + " entry inside " + CLASSES
378 + "]"));
379 return CLASSES + "\\" + m.group(1);
380 }
381 }
382
383 try {
384 File oneOfIcons = null;
385 String extension = null;
386
387 @SuppressWarnings("unchecked")
388 List<Map<String, Object>> associations = (List<Map<String, Object>>) value;
389 final String CLASSES = "HKEY_CURRENT_USER\\Software\\Classes";
390 for (Map<String, Object> association : associations) {
391 // get expected data
392 @SuppressWarnings("unchecked")
393 List<String> extensions = (List<String>) association
394 .get(FA_EXTENSIONS);
395 @SuppressWarnings("unchecked")
396 File icon = (File) association.get(FA_ICON);
397
398 // check association of extension with our application name
399 for (String ext : extensions) {
400
401 Registry.QueryBuilder builder = Registry
402 .getQueryBuilder();
403 builder.key(CLASSES).useDataPattern(ext);
404 Registry.Query query = builder.build();
405 Optional<List<String>> output = query.execute();
406
407 final Predicate<? super String> predicate = str -> str
408 .trim().contains("." + ext);
409 boolean menuItemExists = output
410 .orElse(Collections.emptyList()).stream()
411 .anyMatch(predicate);
412
413 assertTrue(menuItemExists, "[Extension " + ext
414 + " not found in registry " + CLASSES + " ]");
415 }
|