ServiceUtils { public static void setExpandedIndexing(ServiceDocument sd, String... fieldNames) { setIndexingOptions(sd, ServiceDocumentDescription.PropertyIndexingOption.EXPAND, fieldNames); }  static void setTaskInfoErrorStage(TaskState state, Throwable e); static void logInfo(Service service, String fmt, Object... args); static void logSevere(Service service, String fmt, Object... args); static void logSevere(Service service, Throwable e); static void logSevere(Service service, Collection<Throwable> errors); static void logTrace(Service service, String fmt, Object... args); static void logTrace(Service service, Throwable e); static void logWarning(Service service, String fmt, Object... args); static T selectRandomItem(Set<T> items); static long computeExpirationTime(long durationMicros); static String getIDFromDocumentSelfLink(String documentSelfLink); static void setExpandedIndexing(ServiceDocument sd, String... fieldNames); static void setSortedIndexing(ServiceDocument sd, String... fieldNames); static void setIndexingOptions(ServiceDocument sd,
                                        ServiceDocumentDescription.PropertyIndexingOption option,
                                        String... fieldNames); static boolean documentEquals(
      Class<T> type, T document1, T document2); static URI createUriFromServerSet(ServerSet serverSet, String path); static URI createUriFromServerSet(ServerSet serverSet, String path, String protocol); static URI createUriFromServerSet(Set<InetSocketAddress> serverInetSet, String path); static URI createUriFromServerSet(Set<InetSocketAddress> serverInetSet, String path, String protocol); static URI selectLocalServer(ServerSet serverSet, String path); static void failOperationAsBadRequest(Service service, Operation operation, Throwable e); static void failOperationAsBadRequest(Service service,
                                               Operation operation,
                                               Throwable e,
                                               Object failureBody); static Operation doServiceOperation(Service service, Operation requestedOperation); static void expireDocumentOnDelete(
      Service service,
      Class<T> serviceDocumentType,
      Operation deleteOperation); static final long DEFAULT_DOC_EXPIRATION_TIME_MICROS; static final long DEFAULT_ON_DELETE_DOC_EXPIRATION_TIME_MICROS; }
@Test public void testGetDocumentTemplateWithIndexedFields() { ServiceDocument serviceDocument = new ServiceDocument(); serviceDocument.documentDescription = new ServiceDocumentDescription(); serviceDocument.documentDescription.propertyDescriptions = new HashMap<>(); ServiceDocumentDescription.PropertyDescription propertyDescription = new ServiceDocumentDescription.PropertyDescription(); serviceDocument.documentDescription.propertyDescriptions.put("DUMMY_PROPERTY", propertyDescription); assertThat(propertyDescription.indexingOptions.size(), is(0)); ServiceUtils.setExpandedIndexing(serviceDocument, "DUMMY_PROPERTY"); assertThat(propertyDescription.indexingOptions, is(EnumSet.of(ServiceDocumentDescription.PropertyIndexingOption.EXPAND))); }