Skip to content

Commit 9ce2e66

Browse files
Add more test coverage (#44)
* Add unit tests for the JenkinsManager and FileUtils class * Add missing copyright headers * Some minor fixes to solve codacy complaints
1 parent 9637f61 commit 9ce2e66

File tree

11 files changed

+924
-120
lines changed

11 files changed

+924
-120
lines changed

src/main/java/com/ericsson/eiffelcommons/constants/RegExProvider.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2019 Ericsson AB.
3+
For a full list of individual contributors, please see the commit history.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
117
package com.ericsson.eiffelcommons.constants;
218

319
public final class RegExProvider {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2020 Ericsson AB.
3+
For a full list of individual contributors, please see the commit history.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
package com.ericsson.eiffelcommons.exceptions;
18+
19+
public class JenkinsManagerException extends Exception {
20+
21+
private static final long serialVersionUID = 2L;
22+
23+
public JenkinsManagerException() {
24+
super();
25+
}
26+
27+
public JenkinsManagerException(String message) {
28+
super(message);
29+
}
30+
31+
public JenkinsManagerException(String message, Throwable e) {
32+
super(message, e);
33+
}
34+
35+
}

src/main/java/com/ericsson/eiffelcommons/http/HttpRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ public String getBaseUrl() {
136136
* @param baseUrl
137137
*/
138138
public HttpRequest setBaseUrl(String baseUrl) {
139-
baseUrl = trimBaseUrl(baseUrl);
140-
this.baseUrl = baseUrl;
139+
this.baseUrl = trimBaseUrl(baseUrl);
141140
return this;
142141
}
143142

@@ -350,13 +349,14 @@ private URI addParametersToURI(URI oldUri) throws URISyntaxException {
350349
/**
351350
* Function that trims the base url for trailing slashes
352351
*
353-
* @return HttpRequest
352+
* @return trimmedUrl
354353
*/
355354
private String trimBaseUrl(String baseUrl) {
355+
String trimmedUrl = baseUrl;
356356
if (baseUrl.endsWith("/")) {
357-
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
357+
trimmedUrl = baseUrl.substring(0, baseUrl.length() - 1);
358358
}
359359

360-
return baseUrl;
360+
return trimmedUrl;
361361
}
362362
}

0 commit comments

Comments
 (0)