### Question:
ReadOnlyIndexReference extends IndexReference { @Override public void setStale() { throw new UnsupportedOperationException( "Read only indexes can't be marked as stale." ); } ReadOnlyIndexReference( IndexIdentifier identifier, IndexSearcher searcher ); @Override IndexWriter getWriter(); @Override synchronized void dispose(); @Override boolean checkAndClearStale(); @Override void setStale();  }### Answer:
@Test void markAsStaleIsUnsupported() { UnsupportedOperationException uoe = assertThrows( UnsupportedOperationException.class, () -> indexReference.setStale() ); assertEquals( uoe.getMessage(), "Read only indexes can't be marked as stale." ); }