Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 authored and mohamedsamehsalah committed Apr 16, 2023
1 parent 1fbff8c commit 23fe7c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import com.google.errorprone.refaster.annotation.UseImportPolicy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
Expand All @@ -26,6 +27,7 @@
import java.util.TreeSet;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.AbstractBooleanAssert;
import org.assertj.core.api.AbstractCollectionAssert;
import org.assertj.core.api.AbstractMapAssert;
import org.assertj.core.api.MapAssert;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
Expand Down Expand Up @@ -223,13 +225,13 @@ MapAssert<K, V> after(Map<K, V> map, K key) {

static final class AssertThatMapContainsOnlyKeys<K, V> {
@BeforeTemplate
AbstractAssert<?, ?> before(Map<K, V> map, Set<K> keys) {
AbstractCollectionAssert<?, Collection<? extends K>, K, ?> before(Map<K, V> map, Set<K> keys) {
return assertThat(map.keySet()).hasSameElementsAs(keys);
}

@AfterTemplate
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
AbstractAssert<?, ?> after(Map<K, V> map, Set<K> keys) {
MapAssert<K, V> after(Map<K, V> map, Set<K> keys) {
return assertThat(map).containsOnlyKeys(keys);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ MapAssert<Integer, Integer> testAbstractMapAssertHasSameSizeAs() {
}

AbstractAssert<?, ?> testAssertThatMapContainsOnlyKeys() {
return assertThat(ImmutableMap.of(1, 2).keySet()).hasSameElementsAs(ImmutableSet.of(1));
return assertThat(ImmutableMap.of(1, 2).keySet()).hasSameElementsAs(ImmutableSet.of(3));
}

AbstractAssert<?, ?> testAssertThatMapContainsValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ MapAssert<Integer, Integer> testAbstractMapAssertHasSameSizeAs() {
}

AbstractAssert<?, ?> testAssertThatMapContainsOnlyKeys() {
return assertThat(ImmutableMap.of(1, 2)).containsOnlyKeys(ImmutableSet.of(1));
return assertThat(ImmutableMap.of(1, 2)).containsOnlyKeys(ImmutableSet.of(3));
}

AbstractAssert<?, ?> testAssertThatMapContainsValue() {
Expand Down

0 comments on commit 23fe7c6

Please sign in to comment.