Skip to content

Commit

Permalink
Add missing unit test
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Nov 8, 2024
1 parent ac02e67 commit 8c17404
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,44 @@

package org.opensearch.sql.opensearch.data.value;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;
import org.opensearch.sql.opensearch.data.type.OpenSearchIpType;

public class OpenSearchExprIpValueTest {

private OpenSearchExprIpValue ipValue = new OpenSearchExprIpValue("192.168.0.1");
private final String ipString = "192.168.0.1";
private final OpenSearchExprIpValue ipValue = new OpenSearchExprIpValue(ipString);

@Test
void value() {
assertEquals("192.168.0.1", ipValue.value());
void testValue() {
assertEquals(ipString, ipValue.value());
}

@Test
void type() {
void testType() {
assertEquals(OpenSearchIpType.of(), ipValue.type());
}

@Test
void compare() {
assertEquals(0, ipValue.compareTo(new OpenSearchExprIpValue("192.168.0.1")));
assertEquals(ipValue, new OpenSearchExprIpValue("192.168.0.1"));
void testCompare() {
assertEquals(0, ipValue.compareTo(new OpenSearchExprIpValue(ipString)));
assertEquals(ipValue, new OpenSearchExprIpValue(ipString));
}

@Test
void equal() {
assertTrue(ipValue.equal(new OpenSearchExprIpValue("192.168.0.1")));
void testEqual() {
assertTrue(ipValue.equal(new OpenSearchExprIpValue(ipString)));
}

@Test
void testHashCode() {
assertNotNull(ipValue.hashCode());
}

@Test
void testStringValue() {
assertEquals(ipString, ipValue.stringValue());
}
}

0 comments on commit 8c17404

Please sign in to comment.