Skip to content

Commit

Permalink
Merge pull request #1060 from amvanbaren/empty-methods
Browse files Browse the repository at this point in the history
Document empty method body
  • Loading branch information
amvanbaren authored Dec 4, 2024
2 parents ecb71af + 74e0c4f commit 70441f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,45 +151,41 @@ public SearchHits<ExtensionSearch> search(ISearchService.Options options) {
return new SearchHitsImpl<>(totalHits, TotalHitsRelation.OFF, 0f, null, null, searchHits, null, null);
}

/**
* Clear the cache when asked to update the search index. It could be done also
* through a cron job as well
*/
@Override
@CacheEvict(value = CACHE_DATABASE_SEARCH, allEntries = true)
public void updateSearchIndex(boolean clear) {

// The @CacheEvict annotation clears the cache when asked to update the search index
}

@Override
@Async
@CacheEvict(value = CACHE_DATABASE_SEARCH, allEntries = true)
public void updateSearchEntriesAsync(List<Extension> extensions) {

// The @CacheEvict annotation clears the cache when asked to update search entries
}

@Override
@CacheEvict(value = CACHE_DATABASE_SEARCH, allEntries = true)
public void updateSearchEntries(List<Extension> extensions) {

// The @CacheEvict annotation clears the cache when asked to update search entries
}

@Override
@CacheEvict(value = CACHE_DATABASE_SEARCH, allEntries = true)
public void updateSearchEntry(Extension extension) {

// The @CacheEvict annotation clears the cache when asked to update a search entry
}

@Override
@CacheEvict(value = CACHE_DATABASE_SEARCH, allEntries = true)
public void removeSearchEntries(Collection<Long> ids) {

// The @CacheEvict annotation clears the cache when asked to removes search entries
}

@Override
@CacheEvict(value = CACHE_DATABASE_SEARCH, allEntries = true)
public void removeSearchEntry(Extension extension) {

// The @CacheEvict annotation clears the cache when asked to remove a search entry
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public <T> T execute(TransactionCallback<T> action) throws TransactionException

@Override
public void afterPropertiesSet() {
// Method override to prevent IllegalArgumentException from being thrown
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.eclipse.openvsx.util.VersionService;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -415,15 +416,7 @@ void testBrowseVsixManifest() throws Exception {
.andExpect(request().asyncStarted())
.andDo(MvcResult::getAsyncResult)
.andExpect(status().isOk())
.andExpect(content().string(new BaseMatcher<String>() {
@Override
public boolean matches(Object o) {
return ((String) o).startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<PackageManifest Version=\"2.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\" xmlns:d=\"http://schemas.microsoft.com/developer/vsx-schema-design/2011\">");
}

@Override
public void describeTo(Description description) {}
}))
.andExpect(content().string(Matchers.startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<PackageManifest Version=\"2.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\" xmlns:d=\"http://schemas.microsoft.com/developer/vsx-schema-design/2011\">")))
.andDo(result -> Files.delete(path));
}

Expand All @@ -437,15 +430,7 @@ void testBrowseVsixManifestUniversal() throws Exception {
.andExpect(request().asyncStarted())
.andDo(MvcResult::getAsyncResult)
.andExpect(status().isOk())
.andExpect(content().string(new BaseMatcher<String>() {
@Override
public boolean matches(Object o) {
return ((String) o).startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<PackageManifest Version=\"2.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\" xmlns:d=\"http://schemas.microsoft.com/developer/vsx-schema-design/2011\">");
}

@Override
public void describeTo(Description description) {}
}))
.andExpect(content().string(Matchers.startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<PackageManifest Version=\"2.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\" xmlns:d=\"http://schemas.microsoft.com/developer/vsx-schema-design/2011\">")))
.andDo(result -> Files.delete(path));
}

Expand All @@ -459,15 +444,7 @@ void testBrowseVsixManifestWindows() throws Exception {
.andExpect(request().asyncStarted())
.andDo(MvcResult::getAsyncResult)
.andExpect(status().isOk())
.andExpect(content().string(new BaseMatcher<String>() {
@Override
public boolean matches(Object o) {
return ((String) o).startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<PackageManifest Version=\"2.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\" xmlns:d=\"http://schemas.microsoft.com/developer/vsx-schema-design/2011\">");
}

@Override
public void describeTo(Description description) {}
}))
.andExpect(content().string(Matchers.startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<PackageManifest Version=\"2.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vsx-schema/2011\" xmlns:d=\"http://schemas.microsoft.com/developer/vsx-schema-design/2011\">")))
.andDo(result -> Files.delete(path));
}

Expand Down Expand Up @@ -507,23 +484,8 @@ void testBrowsePackageJson() throws Exception {
.andExpect(request().asyncStarted())
.andDo(MvcResult::getAsyncResult)
.andExpect(status().isOk())
.andExpect(content().string(new BaseMatcher<String>() {
@Override
public boolean matches(Object o) {
var mapper = new ObjectMapper();
try {
var json = mapper.readTree((String) o);
return json.get("name").asText().equals(extensionName)
&& json.get("publisher").asText().equals(namespaceName)
&& json.get("version").asText().equals(version);
} catch (IOException e) {
return false;
}
}

@Override
public void describeTo(Description description) {}
})) .andDo(result -> Files.delete(path));
.andExpect(content().json("{\"name\":" + extensionName + ",\"publisher\":" + namespaceName + ",\"version\":" + version + "}"))
.andDo(result -> Files.delete(path));
}

@Test
Expand Down

0 comments on commit 70441f1

Please sign in to comment.