Skip to content

Commit 24ab08e

Browse files
committed
Remove unwanted assertions. Address review comments
1 parent 78e61d0 commit 24ab08e

5 files changed

Lines changed: 15 additions & 19 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.uid2</groupId>
88
<artifactId>uid2-operator</artifactId>
9-
<version>5.40.87-alpha-110-SNAPSHOT</version>
9+
<version>5.40.86</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/com/uid2/operator/monitoring/StatsCollectorVerticle.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ public void handleMessage(Message message) {
8888
return;
8989
}
9090

91-
if (messageItem == null) {
92-
throw new NullPointerException("Message could not be deserialized");
93-
}
94-
9591
String path = messageItem.getPath();
9692
String apiVersion = "v0";
9793
String endpoint = path.substring(1);

src/main/java/com/uid2/operator/store/CloudSyncOptOutStore.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ private OptOutStoreSnapshot updateIndexInternal(IndexUpdateContext iuc) {
604604
if (numPartitions == 0) {
605605
// if update doesn't have a new partition, simply update heap with new log data
606606
if (!iuc.getDeltasToRemove().isEmpty()) {
607-
final String errorMsg = "Invalid number of Deltas to remove=" + iuc.getDeltasToRemove().size();
607+
final String errorMsg = "Invalid number of Deltas to remove=" + iuc.getDeltasToRemove().size()
608+
+ " when there are 0 new partitions to index";
608609
LOGGER.error(errorMsg);
609610
throw new IllegalStateException(errorMsg);
610611
}

src/main/java/com/uid2/operator/util/Tuple.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package com.uid2.operator.util;
22

3+
import java.util.Objects;
4+
35
public class Tuple {
46
public static class Tuple2<T1, T2> {
57
private final T1 item1;
68
private final T2 item2;
79

810
public Tuple2(T1 item1, T2 item2) {
9-
if (item1 == null || item2 == null) {
10-
throw new NullPointerException();
11-
}
11+
Objects.requireNonNull(item1);
12+
Objects.requireNonNull(item2);
1213

1314
this.item1 = item1;
1415
this.item2 = item2;
@@ -35,9 +36,9 @@ public static class Tuple3<T1, T2, T3> {
3536
private final T3 item3;
3637

3738
public Tuple3(T1 item1, T2 item2, T3 item3) {
38-
if (item1 == null || item2 == null || item3 == null) {
39-
throw new NullPointerException();
40-
}
39+
Objects.requireNonNull(item1);
40+
Objects.requireNonNull(item2);
41+
Objects.requireNonNull(item3);
4142

4243
this.item1 = item1;
4344
this.item2 = item2;

src/test/java/com/uid2/operator/V2RequestUtilTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import static org.assertj.core.api.Assertions.assertThat;
2525
import static org.junit.jupiter.api.Assertions.assertEquals;
26-
import static org.junit.jupiter.api.Assertions.fail;
26+
import static org.junit.jupiter.api.Assertions.assertThrowsExactly;
2727
import static org.mockito.Mockito.mock;
2828
import static org.mockito.Mockito.when;
2929

@@ -153,11 +153,9 @@ public void testHandleRefreshTokenInResponseBody() {
153153
when(keyManager.getRefreshKey()).thenReturn(refreshKey);
154154
when(refreshKey.getId()).thenReturn(Integer.MAX_VALUE);
155155
when(refreshKey.getKeyBytes()).thenReturn(Random.getRandomKeyBytes());
156-
try {
157-
V2RequestUtil.handleRefreshTokenInResponseBody(jsonBody, keyManager, IdentityScope.UID2);
158-
fail("IllegalArgumentException not thrown");
159-
} catch (IllegalArgumentException e) {
160-
assertEquals("Generated refresh token's length=168 is not equal to=388", e.getMessage());
161-
}
156+
IllegalArgumentException e = assertThrowsExactly(
157+
IllegalArgumentException.class,
158+
() -> V2RequestUtil.handleRefreshTokenInResponseBody(jsonBody, keyManager, IdentityScope.UID2));
159+
assertEquals("Generated refresh token's length=168 is not equal to=388", e.getMessage());
162160
}
163161
}

0 commit comments

Comments
 (0)