Skip to content

Commit 9907f00

Browse files
committed
Use pubDate, use instance comparasion.
1 parent e10956f commit 9907f00

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/test/java/org/dataone/cn/index/DataONESolrJettyTestBase.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.nio.charset.StandardCharsets;
1010
import java.text.DateFormat;
1111
import java.text.SimpleDateFormat;
12+
import java.time.Instant;
1213
import java.util.ArrayList;
1314
import java.util.Arrays;
1415
import java.util.Collection;
@@ -229,7 +230,13 @@ protected void compareFields(SolrDocument solrResult, Document metadataDoc,
229230
String docValue = docField.getValue();
230231
System.out.println("Doc Value: " + docValue);
231232
System.out.println("Solr Value: " + solrValue);
232-
Assert.assertEquals(docField.getValue(), solrValue);
233+
if (docField.getName().equals("pubDate")) {
234+
Instant expectedInstant = Instant.parse(docValue);
235+
Instant actualInstant = Instant.parse(solrValue);
236+
assertEquals(expectedInstant, actualInstant);
237+
} else {
238+
Assert.assertEquals(docField.getValue(), solrValue);
239+
}
233240
} else if (solrValueObject instanceof Boolean) {
234241
Boolean solrValue = (Boolean) solrValueObject;
235242
Boolean docValue = Boolean.valueOf(docField.getValue());

0 commit comments

Comments
 (0)