Skip to content

Commit

Permalink
Use Assert
Browse files Browse the repository at this point in the history
Change-Id: I708c3678df8ce64d5db49c40f8a3642738f00ca9
  • Loading branch information
Linary committed Dec 15, 2020
1 parent 24488b0 commit 16a6779
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.baidu.hugegraph.structure.graph.Edge;
import com.baidu.hugegraph.structure.graph.Vertex;
import com.baidu.hugegraph.testutil.Assert;
import com.baidu.hugegraph.util.E;

public class LoadTest {

Expand Down Expand Up @@ -101,8 +100,8 @@ protected static void assertContains(List<Edge> edges, String label,
}

private static Map<String, Object> toMap(Object... properties) {
E.checkArgument((properties.length & 0x01) == 0,
"The number of properties must be even");
Assert.assertTrue("The number of properties must be even",
(properties.length & 0x01) == 0);
Map<String, Object> map = new LinkedHashMap<>();
for (int i = 0; i < properties.length; i = i + 2) {
if (!properties[i].equals(T.id) && !properties[i].equals(T.label)) {
Expand All @@ -114,20 +113,20 @@ private static Map<String, Object> toMap(Object... properties) {

public static void assertDateEquals(String expectDate, Object actualDate)
throws java.text.ParseException {
E.checkArgument(actualDate instanceof String,
"Date value must be String class");
Assert.assertEquals("Date value must be String class",
String.class, actualDate.getClass());
assertDateEquals(expectDate, TimeZone.getTimeZone("GMT+8"),
(String) actualDate, TimeZone.getDefault());
}

public static void assertDateEquals(List<String> expectDates,
Object actualDates)
throws java.text.ParseException {
E.checkArgument(actualDates instanceof List,
"Date value must be List<String> class");
Assert.assertEquals("Date value must be List<String> class",
List.class, actualDates.getClass());
List<String> actualDateList = (List<String>) actualDates;
E.checkArgument(expectDates.size() == actualDateList.size(),
"The size of expect and actual dates must be equal");
Assert.assertEquals("The size of expect and actual dates must be equal",
expectDates.size(), actualDateList.size());
int n = expectDates.size();
for (int i = 0; i < n; i++) {
assertDateEquals(expectDates.get(i), TimeZone.getTimeZone("GMT+8"),
Expand Down

0 comments on commit 16a6779

Please sign in to comment.