Skip to content

Commit

Permalink
GEODE-7407: Fix Test Warnings (apache#4301)
Browse files Browse the repository at this point in the history
- Fixed some minor warnings in tests.
- Replaced usages of 'junit.Assert' by 'assertj'.
  • Loading branch information
jujoramos authored Nov 8, 2019
1 parent 8525f2c commit 0caabdb
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package org.apache.geode.rest.internal.web.controllers;

import static org.junit.Assert.assertFalse;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -31,11 +31,10 @@
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.rest.internal.web.RestFunctionTemplate;
import org.apache.geode.test.dunit.LogWriterUtils;
import org.apache.geode.test.junit.categories.RestAPITest;
import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;

@Category({RestAPITest.class})
@Category(RestAPITest.class)
@RunWith(Parameterized.class)
@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
public class RestAPIsOnGroupsFunctionExecutionDUnitTest extends RestAPITestBase {
Expand All @@ -48,7 +47,6 @@ public static Collection<String> data() {
return Arrays.asList("/geode", "/gemfire-api");
}


private void setupCacheWithGroupsAndFunction() {
restURLs.add(vm0.invoke("createCacheWithGroups",
() -> createCacheWithGroups(vm0.getHost().getHostName(), "g0,gm", urlContext)));
Expand Down Expand Up @@ -125,18 +123,19 @@ public void testBasicP2PFunctionSelectedGroup() {
restURLs.clear();
}

private class OnGroupsFunction extends RestFunctionTemplate {
@SuppressWarnings("unchecked")
private static class OnGroupsFunction extends RestFunctionTemplate {
static final String Id = "OnGroupsFunction";

@Override
public void execute(FunctionContext context) {
LogWriterUtils.getLogWriter().fine("SWAP:1:executing OnGroupsFunction:" + invocationCount);
InternalDistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
invocationCount++;
ArrayList<String> l = (ArrayList<String>) context.getArguments();
if (l != null) {
assertFalse(Collections.disjoint(l, ds.getDistributedMember().getGroups()));
assertThat(Collections.disjoint(l, ds.getDistributedMember().getGroups())).isFalse();
}

context.getResultSender().lastResult(Boolean.TRUE);
}

Expand Down

0 comments on commit 0caabdb

Please sign in to comment.