return true;
}
- if (!(o instanceof DefaultIndexedFile)) {
+ if (o == null || o.getClass() != this.getClass()) {
return false;
}
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof DefaultTextPointer)) {
+ if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
DefaultTextPointer other = (DefaultTextPointer) obj;
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof DefaultTextRange)) {
+ if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
DefaultTextRange other = (DefaultTextRange) obj;
* filePath must point to a file that is within the module base directory.
*/
public TestInputFileBuilder(String projectKey, File moduleBaseDir, File filePath) {
- String relativePath = moduleBaseDir.toPath().relativize(filePath.toPath()).toString();
+ String relativePathStr = moduleBaseDir.toPath().relativize(filePath.toPath()).toString();
this.projectKey = projectKey;
setModuleBaseDir(moduleBaseDir.toPath());
- this.relativePath = PathUtils.sanitize(relativePath);
+ this.relativePath = PathUtils.sanitize(relativePathStr);
this.id = batchId++;
}
public abstract class DefaultStorable {
- protected final transient SensorStorage storage;
- private transient boolean saved = false;
+ protected final SensorStorage storage;
+ private boolean saved = false;
public DefaultStorable() {
this.storage = null;
@Override
public List<String> multiParam(String key) {
WebService.Param definition = action.param(key);
+ if (definition == null) {
+ throw new IllegalArgumentException("Parameter '" + key + "' not found for action '" + action.key() + "'");
+ }
List<String> values = readMultiParamOrDefaultValue(key, definition);
return validateValues(values, definition);
}
checkArgument(valueAsInt <= maximumValue, "'%s' value (%s) must be less than %s", key, valueAsInt, maximumValue);
}
- private static void validateRequiredValue(String key, WebService.Param definition, String value) {
+ private static void validateRequiredValue(String key, WebService.Param definition, @Nullable String value) {
boolean required = definition.isRequired();
if (required) {
checkArgument(value != null, format(MSG_PARAMETER_MISSING, key));
@Test
public void fail_if_multi_param_is_not_defined() {
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("BUG - parameter 'unknown' is undefined for action 'my_action'");
+ expectedException.expectMessage("Parameter 'unknown' not found for action 'my_action'");
underTest.multiParam("unknown");
}