Skip to content

Commit 8e086a5

Browse files
📢 removed e.printStackTrace();
1 parent 63efdee commit 8e086a5

File tree

4 files changed

+24
-44
lines changed

4 files changed

+24
-44
lines changed

pom.xml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
<artifactId>cms</artifactId>
88
<name>contentstack-management-java</name>
99
<version>0.0.1-SNAPSHOT</version>
10-
<description>Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an
11-
API-first
12-
approach
10+
<description>Contentstack Java Management SDK for Content Management API,
11+
Contentstack is a headless CMS with an API-first approach
1312
</description>
1413
<url>https://github.com/contentstack/contentstack-management-java/</url>
1514

@@ -72,8 +71,6 @@
7271
</distributionManagement>
7372

7473
<properties>
75-
<!--Keep all dependencies' version updated before pushing to git-->
76-
<!--update sdk version before every release push for SNAPSHOT/RELEASE-->
7774
<sdk.version>0.0.1</sdk.version>
7875
<sdk.version.snapshot>${sdk.version}-SNAPSHOT</sdk.version.snapshot>
7976
<maven.compiler.target>1.8</maven.compiler.target>
@@ -166,7 +163,6 @@
166163

167164
<build>
168165
<plugins>
169-
170166
<plugin>
171167
<groupId>org.apache.maven.plugins</groupId>
172168
<artifactId>maven-jxr-plugin</artifactId>
@@ -238,11 +234,6 @@
238234
<artifactId>maven-site-plugin</artifactId>
239235
<version>${maven-site-plugin.version}</version>
240236
</plugin>
241-
<!--
242-
Signs all of a project's attached artifacts with GnuPG.
243-
You need to have previously configured the default key.
244-
gpg also needs to be on the search path.
245-
-->
246237
<plugin>
247238
<groupId>org.apache.maven.plugins</groupId>
248239
<artifactId>maven-gpg-plugin</artifactId>
@@ -257,13 +248,6 @@
257248
</execution>
258249
</executions>
259250
</plugin>
260-
261-
<!--
262-
Sometimes when you may need to compile a certain project to a different
263-
version than what you are currently using. The javac can accept such command
264-
using -source and -target. The Compiler Plugin can also be configured to
265-
provide these options during compilation
266-
-->
267251
<plugin>
268252
<groupId>org.apache.maven.plugins</groupId>
269253
<artifactId>maven-compiler-plugin</artifactId>
@@ -287,10 +271,6 @@
287271
<autoReleaseAfterClose>true</autoReleaseAfterClose>
288272
</configuration>
289273
</plugin>
290-
<!--
291-
This plugin is used to release a project with Maven, saving a lot of repetitive, manual work.
292-
Releasing a project is made in two steps: prepare and perform.
293-
-->
294274
<plugin>
295275
<groupId>org.apache.maven.plugins</groupId>
296276
<artifactId>maven-release-plugin</artifactId>

src/test/java/com/contentstack/cms/Utils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
import java.io.File;
1212
import java.io.FileReader;
1313
import java.io.IOException;
14+
import java.util.logging.Logger;
1415

1516
public class Utils {
1617

18+
private final static Logger log = Logger.getLogger(Utils.class.getName());
19+
1720
public static JsonObject toJson(Response<ResponseBody> response) throws IOException {
1821
assert response.body() != null;
1922
return new Gson().fromJson(response.body().string(), JsonObject.class);
@@ -26,7 +29,7 @@ public static JSONObject createJSONObject(String jsonString) {
2629
try {
2730
jsonObject = (JSONObject) jsonParser.parse(jsonString);
2831
} catch (org.json.simple.parser.ParseException e) {
29-
e.printStackTrace();
32+
log.warning(e.getLocalizedMessage().toString());
3033
}
3134
}
3235
return jsonObject;
@@ -39,7 +42,7 @@ public static JSONObject readJson(String file) {
3942
Object obj = new JSONParser().parse(new FileReader(new File(path).getPath()));
4043
mockJsonObject = (JSONObject) obj;
4144
} catch (IOException | ParseException e) {
42-
e.printStackTrace();
45+
log.warning(e.getLocalizedMessage().toString());
4346
}
4447
return mockJsonObject;
4548
}

src/test/java/com/contentstack/cms/stack/StackAPITest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
class StackAPITest {
2121

2222
private static final String TAG = StackAPITest.class.getSimpleName();
23-
private final Logger log = Logger.getLogger(RetryCallback.class.getName());
23+
private final static Logger log = Logger.getLogger(StackAPITest.class.getName());
24+
// log.warning(e.getLocalizedMessage().toString());
2425

2526
private Stack stackInstance;
2627
private final String organizationUid = Dotenv.load().get("organizationUid");
@@ -56,7 +57,7 @@ void testStackFetchAll() {
5657
Assertions.fail();
5758
}
5859
} catch (IOException e) {
59-
e.printStackTrace();
60+
log.warning(e.getLocalizedMessage().toString());
6061
}
6162
}
6263

@@ -73,7 +74,7 @@ void testFetchWithOptionalOrgUid() {
7374
Assertions.fail();
7475
}
7576
} catch (IOException e) {
76-
e.printStackTrace();
77+
log.warning(e.getLocalizedMessage().toString());
7778
}
7879
}
7980

@@ -94,7 +95,7 @@ void testFetchWithOptionalQueryParams() {
9495
Assertions.fail();
9596
}
9697
} catch (IOException e) {
97-
e.printStackTrace();
98+
log.warning(e.getLocalizedMessage().toString());
9899
}
99100
}
100101

@@ -116,7 +117,7 @@ void testFetchWithOptionalOrgUidAndQueryParams() {
116117
Assertions.fail();
117118
}
118119
} catch (IOException e) {
119-
e.printStackTrace();
120+
log.warning(e.getLocalizedMessage().toString());
120121
}
121122
}
122123

@@ -142,7 +143,7 @@ void testCreateStack() {
142143
Assertions.fail();
143144
}
144145
} catch (IOException e) {
145-
e.printStackTrace();
146+
log.warning(e.getLocalizedMessage().toString());
146147
}
147148
}
148149

@@ -164,7 +165,7 @@ void testStackUpdate() {
164165
Assertions.fail();
165166
}
166167
} catch (IOException e) {
167-
e.printStackTrace();
168+
log.warning(e.getLocalizedMessage().toString());
168169
}
169170
}
170171

@@ -189,7 +190,7 @@ void testStackTransferOwnership() {
189190
errMessage);
190191
}
191192
} catch (IOException e) {
192-
e.printStackTrace();
193+
log.warning(e.getLocalizedMessage().toString());
193194
}
194195
}
195196

@@ -245,7 +246,7 @@ void testStackSetting() {
245246
Assertions.fail();
246247
}
247248
} catch (IOException e) {
248-
e.printStackTrace();
249+
log.warning(e.getLocalizedMessage().toString());
249250
}
250251
}
251252

@@ -275,7 +276,7 @@ void testStackUpdateSetting() {
275276
Assertions.fail();
276277
}
277278
} catch (IOException e) {
278-
e.printStackTrace();
279+
log.warning(e.getLocalizedMessage().toString());
279280
}
280281
}
281282

@@ -300,7 +301,7 @@ void testStackResetSetting() {
300301
Assertions.fail();
301302
}
302303
} catch (IOException e) {
303-
e.printStackTrace();
304+
log.warning(e.getLocalizedMessage().toString());
304305
}
305306
}
306307

@@ -331,7 +332,7 @@ void testStackShare() {
331332
response.raw().request().headers().size());
332333
}
333334
} catch (IOException e) {
334-
e.printStackTrace();
335+
log.warning(e.getLocalizedMessage().toString());
335336
}
336337
}
337338

@@ -355,7 +356,7 @@ void testStackUnshare() {
355356
response.raw().request().headers().size());
356357
}
357358
} catch (IOException e) {
358-
e.printStackTrace();
359+
log.warning(e.getLocalizedMessage().toString());
359360
}
360361
}
361362

@@ -400,7 +401,7 @@ void testStackRole() {
400401
response.raw().request().headers().size());
401402
}
402403
} catch (IOException e) {
403-
e.printStackTrace();
404+
log.warning(e.getLocalizedMessage().toString());
404405
}
405406
}
406407

src/test/java/com/contentstack/cms/user/UserMockTests.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public JSONObject readJson(String file) {
4141
Object obj = new JSONParser().parse(new FileReader(new File(path).getPath()));
4242
mockJsonObject = (JSONObject) obj;
4343
} catch (IOException | ParseException e) {
44-
e.printStackTrace();
44+
logger.warning(e.getLocalizedMessage());
4545
}
4646
logger.fine(mockJsonObject.toJSONString());
4747
return mockJsonObject;
@@ -59,10 +59,8 @@ public void setupBeforeAll() {
5959
* Mock test get user.
6060
*/
6161
@Test
62-
@DisplayName("Mock testcase for get user to check with all available keys")
6362
@Order(1)
64-
@TestFactory
65-
void mock_test_get_user() {
63+
void mockTestGetUser() {
6664
JSONObject getUserJSONObj = readJson("getuser.json");
6765
mockJsonObject = (JSONObject) getUserJSONObj.get("user");
6866
Set allKeys = mockJsonObject.keySet();
@@ -101,7 +99,6 @@ void mock_test_get_user() {
10199
* Test mock testcase update user.
102100
*/
103101
@Test
104-
@DisplayName("Mock testcase for update user")
105102
@Order(2)
106103
void test_mock_testcase_update_user() {
107104
mockJsonObject = readJson("updateuser.json");
@@ -134,7 +131,6 @@ void test_mock_testcase_update_user() {
134131
* Test mock testcase activate user.
135132
*/
136133
@Test
137-
@DisplayName("Mock test notice message for activate user")
138134
@Order(3)
139135
void test_mock_testcase_activate_user() {
140136
mockJsonObject = readJson("activateuser.json");

0 commit comments

Comments
 (0)