@@ -725,6 +725,8 @@ public XContentBuilder timeField(String name, Object timeValue) throws IOExcepti
725725 * {@link Long} class.
726726 */
727727 public XContentBuilder timeField (String name , String readableName , long value ) throws IOException {
728+ assert name .equals (readableName ) == false :
729+ "expected raw and readable field names to differ, but they were both: " + name ;
728730 if (humanReadable ) {
729731 Function <Object , Object > longTransformer = DATE_TRANSFORMERS .get (Long .class );
730732 if (longTransformer == null ) {
@@ -937,6 +939,8 @@ private XContentBuilder value(Iterable<?> values, boolean ensureNoSelfReferences
937939 //////////////////////////////////
938940
939941 public XContentBuilder humanReadableField (String rawFieldName , String readableFieldName , Object value ) throws IOException {
942+ assert rawFieldName .equals (readableFieldName ) == false :
943+ "expected raw and readable field names to differ, but they were both: " + rawFieldName ;
940944 if (humanReadable ) {
941945 field (readableFieldName , Objects .toString (value ));
942946 }
@@ -956,6 +960,8 @@ public XContentBuilder humanReadableField(String rawFieldName, String readableFi
956960
957961
958962 public XContentBuilder percentageField (String rawFieldName , String readableFieldName , double percentage ) throws IOException {
963+ assert rawFieldName .equals (readableFieldName ) == false :
964+ "expected raw and readable field names to differ, but they were both: " + rawFieldName ;
959965 if (humanReadable ) {
960966 field (readableFieldName , String .format (Locale .ROOT , "%1.1f%%" , percentage ));
961967 }
0 commit comments