tests and PMD and coverage
This commit is contained in:
		
							parent
							
								
									f0fcbefdbb
								
							
						
					
					
						commit
						99d2faf97d
					
				
					 9 changed files with 29 additions and 32 deletions
				
			
		| 
						 | 
					@ -15,6 +15,8 @@
 | 
				
			||||||
    <rule ref="category/java/errorprone.xml" >
 | 
					    <rule ref="category/java/errorprone.xml" >
 | 
				
			||||||
        <exclude name="AvoidDuplicateLiterals"/>
 | 
					        <exclude name="AvoidDuplicateLiterals"/>
 | 
				
			||||||
        <exclude name="BeanMembersShouldSerialize"/>
 | 
					        <exclude name="BeanMembersShouldSerialize"/>
 | 
				
			||||||
 | 
					        <exclude name="AvoidFieldNameMatchingMethodName"/>
 | 
				
			||||||
 | 
					        <exclude name="NullAssignment"/>
 | 
				
			||||||
    </rule>
 | 
					    </rule>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</ruleset>
 | 
					</ruleset>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								pom.xml
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								pom.xml
									
										
									
									
									
								
							| 
						 | 
					@ -173,14 +173,6 @@
 | 
				
			||||||
                <goals>
 | 
					                <goals>
 | 
				
			||||||
                  <goal>report</goal>
 | 
					                  <goal>report</goal>
 | 
				
			||||||
                </goals>
 | 
					                </goals>
 | 
				
			||||||
                <configuration>
 | 
					 | 
				
			||||||
                  <excludes>
 | 
					 | 
				
			||||||
                    <exclude>ch/ethz/seb/sebserver/gui/content/**/*</exclude>
 | 
					 | 
				
			||||||
                    <exclude>ch/ethz/seb/sebserver/gui/form/**/*</exclude>
 | 
					 | 
				
			||||||
                    <exclude>ch/ethz/seb/sebserver/gui/table/**/*</exclude>
 | 
					 | 
				
			||||||
                    <exclude>ch/ethz/seb/sebserver/gui/widget/**/*</exclude>
 | 
					 | 
				
			||||||
                  </excludes>
 | 
					 | 
				
			||||||
                </configuration>
 | 
					 | 
				
			||||||
              </execution>
 | 
					              </execution>
 | 
				
			||||||
              <execution>
 | 
					              <execution>
 | 
				
			||||||
                <id>post-unit-test</id>
 | 
					                <id>post-unit-test</id>
 | 
				
			||||||
| 
						 | 
					@ -198,9 +190,9 @@
 | 
				
			||||||
              </execution>
 | 
					              </execution>
 | 
				
			||||||
            </executions>
 | 
					            </executions>
 | 
				
			||||||
            <configuration>
 | 
					            <configuration>
 | 
				
			||||||
              <includes>
 | 
					<!--               <includes> -->
 | 
				
			||||||
                <include>ch/ethz/seb/sebserver/*</include>
 | 
					<!--                 <include>ch/ethz/seb/sebserver/*</include> -->
 | 
				
			||||||
              </includes>
 | 
					<!--               </includes> -->
 | 
				
			||||||
              <excludes>
 | 
					              <excludes>
 | 
				
			||||||
                <exclude>ch/ethz/seb/sebserver/gui/content/**/*</exclude>
 | 
					                <exclude>ch/ethz/seb/sebserver/gui/content/**/*</exclude>
 | 
				
			||||||
                <exclude>ch/ethz/seb/sebserver/gui/form/**/*</exclude>
 | 
					                <exclude>ch/ethz/seb/sebserver/gui/form/**/*</exclude>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -207,8 +207,8 @@ public final class Result<T> {
 | 
				
			||||||
                    throw new IllegalArgumentException("Use flatMap instead!");
 | 
					                    throw new IllegalArgumentException("Use flatMap instead!");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return Result.of(result);
 | 
					                return Result.of(result);
 | 
				
			||||||
            } catch (final Throwable t) {
 | 
					            } catch (final Exception e) {
 | 
				
			||||||
                return Result.ofError(t);
 | 
					                return Result.ofError(e);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            return Result.ofError(this.error);
 | 
					            return Result.ofError(this.error);
 | 
				
			||||||
| 
						 | 
					@ -230,8 +230,8 @@ public final class Result<T> {
 | 
				
			||||||
        if (this.error == null) {
 | 
					        if (this.error == null) {
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                return mapf.apply(this.value);
 | 
					                return mapf.apply(this.value);
 | 
				
			||||||
            } catch (final Throwable t) {
 | 
					            } catch (final Exception e) {
 | 
				
			||||||
                return Result.ofError(t);
 | 
					                return Result.ofError(e);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            return Result.ofError(this.error);
 | 
					            return Result.ofError(this.error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,6 +151,7 @@ public abstract class AbstractTableFieldBuilder implements InputFieldBuilder {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            default: {
 | 
					            default: {
 | 
				
			||||||
                item.setText(cellIndex, getValue(attribute, tableValue));
 | 
					                item.setText(cellIndex, getValue(attribute, tableValue));
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,6 +145,8 @@ public class ViewGridBuilder {
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                default: {
 | 
					                default: {
 | 
				
			||||||
 | 
					                    // do nothing
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } catch (final ArrayIndexOutOfBoundsException e) {
 | 
					        } catch (final ArrayIndexOutOfBoundsException e) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ public class ComposerServiceImpl implements ComposerService {
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                composer.compose(pageContext);
 | 
					                composer.compose(pageContext);
 | 
				
			||||||
                PageService.updateScrolledComposite(pageContext.getParent());
 | 
					                PageService.updateScrolledComposite(pageContext.getParent());
 | 
				
			||||||
            } catch (final Throwable e) {
 | 
					            } catch (final Exception e) {
 | 
				
			||||||
                log.error("Failed to compose: {}, pageContext: {}", name, pageContext, e);
 | 
					                log.error("Failed to compose: {}, pageContext: {}", name, pageContext, e);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -143,10 +143,10 @@ public final class PageAction {
 | 
				
			||||||
                PageAction.this.pageContext.notifyError("action.error.unexpected.message", restCallError);
 | 
					                PageAction.this.pageContext.notifyError("action.error.unexpected.message", restCallError);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return Result.ofError(restCallError);
 | 
					            return Result.ofError(restCallError);
 | 
				
			||||||
        } catch (final Throwable t) {
 | 
					        } catch (final Exception e) {
 | 
				
			||||||
            log.error("Failed to execute action: {}", PageAction.this, t);
 | 
					            log.error("Failed to execute action: {}", PageAction.this, e);
 | 
				
			||||||
            PageAction.this.pageContext.notifyError("action.error.unexpected.message", t);
 | 
					            PageAction.this.pageContext.notifyError("action.error.unexpected.message", e);
 | 
				
			||||||
            return Result.ofError(t);
 | 
					            return Result.ofError(e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -327,10 +327,10 @@ public class PageContextImpl implements PageContext {
 | 
				
			||||||
            if (returnCode == SWT.OK) {
 | 
					            if (returnCode == SWT.OK) {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    this.onOK.accept(true);
 | 
					                    this.onOK.accept(true);
 | 
				
			||||||
                } catch (final Throwable t) {
 | 
					                } catch (final Exception e) {
 | 
				
			||||||
                    log.error(
 | 
					                    log.error(
 | 
				
			||||||
                            "Unexpected on confirm callback execution. This should not happen, plase secure the given onOK Runnable",
 | 
					                            "Unexpected on confirm callback execution. This should not happen, plase secure the given onOK Runnable",
 | 
				
			||||||
                            t);
 | 
					                            e);
 | 
				
			||||||
                    this.onOK.accept(false);
 | 
					                    this.onOK.accept(false);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,11 +115,11 @@ public abstract class RestCall<T> {
 | 
				
			||||||
                return handleRestCallError(responseEntity);
 | 
					                return handleRestCallError(responseEntity);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } catch (final Throwable t) {
 | 
					        } catch (final Exception e) {
 | 
				
			||||||
            final RestCallError restCallError = new RestCallError("Unexpected error while rest call", t);
 | 
					            final RestCallError restCallError = new RestCallError("Unexpected error while rest call", e);
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                final String responseBody = ((RestClientResponseException) t).getResponseBodyAsString();
 | 
					                final String responseBody = ((RestClientResponseException) e).getResponseBodyAsString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                restCallError.errors.addAll(RestCall.this.jsonMapper.readValue(
 | 
					                restCallError.errors.addAll(RestCall.this.jsonMapper.readValue(
 | 
				
			||||||
                        responseBody,
 | 
					                        responseBody,
 | 
				
			||||||
| 
						 | 
					@ -127,16 +127,16 @@ public abstract class RestCall<T> {
 | 
				
			||||||
                        }));
 | 
					                        }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            } catch (final ClassCastException cce) {
 | 
					            } catch (final ClassCastException cce) {
 | 
				
			||||||
                log.error("Unexpected error-response while webservice API call for: {}", builder, t);
 | 
					                log.error("Unexpected error-response while webservice API call for: {}", builder, e);
 | 
				
			||||||
                restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(t));
 | 
					                restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(e));
 | 
				
			||||||
            } catch (final RuntimeException re) {
 | 
					            } catch (final RuntimeException re) {
 | 
				
			||||||
                log.error("Unexpected runtime error while webservice API call for: {}", builder, re);
 | 
					                log.error("Unexpected runtime error while webservice API call for: {}", builder, re);
 | 
				
			||||||
                log.error("Unexpected runtime error cause: ", t);
 | 
					                log.error("Unexpected runtime error cause: ", e);
 | 
				
			||||||
                restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(re));
 | 
					                restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(re));
 | 
				
			||||||
            } catch (final Exception e) {
 | 
					            } catch (final Exception ee) {
 | 
				
			||||||
                log.error("Unexpected error while webservice API call for: {}", builder, e);
 | 
					                log.error("Unexpected error while webservice API call for: {}", builder, ee);
 | 
				
			||||||
                log.error("Unexpected error cause: ", t);
 | 
					                log.error("Unexpected error cause: ", e);
 | 
				
			||||||
                restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(e));
 | 
					                restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(ee));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return Result.ofError(restCallError);
 | 
					            return Result.ofError(restCallError);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue