package com.atlassian.bitbucket.hamcrest;

import com.atlassian.bitbucket.property.PropertyMap;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;

import javax.annotation.Nonnull;

import static org.hamcrest.Matchers.is;

public class PropertyMapMatchers {

    private PropertyMapMatchers() {
        throw new UnsupportedOperationException(PropertyMapMatchers.class.getName() + " should not be instantiated");
    }

    @Nonnull
    public static Matcher<PropertyMap> hasEntry(@Nonnull String expectedKey, @Nonnull Object expectedValue) {
        return hasEntryThat(is(expectedKey), is(expectedValue));
    }

    @Nonnull
    @SuppressWarnings("unchecked")
    public static Matcher<PropertyMap> hasEntryThat(@Nonnull Matcher<String> keyMatcher,
                                                    @Nonnull Matcher<Object> valueMatcher) {
        return (Matcher) Matchers.hasEntry(keyMatcher, valueMatcher);
    }
}
