@@ -0,0 +1,3191 @@
+package org.monospark.spongematchers.type;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.CoreMatchers.not;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.monospark.spongematchers.testutil.HamcrestSpongeMatchers.matches;%0A%0Aimport org.junit.Test;%0Aimport org.monospark.spongematchers.matcher.SpongeMatcher;%0Aimport org.monospark.spongematchers.parser.SpongeMatcherParseException;%0Aimport org.monospark.spongematchers.parser.element.StringElement;%0Aimport org.monospark.spongematchers.parser.element.StringElementParser;%0Aimport org.spongepowered.api.data.Property;%0Aimport org.spongepowered.api.data.property.PropertyHolder;%0Aimport org.spongepowered.api.data.property.block.MatterProperty;%0A%0Aimport com.google.common.collect.ImmutableSet;%0A%0Apublic class PropertyHolderTest %7B%0A%0A    @Test%0A    public void canMatch_NonLocationObject_ReturnsFalse() throws SpongeMatcherParseException %7B%0A        Object o = 5;%0A        %0A        boolean canMatch = MatcherType.PROPERTY_HOLDER.canMatch(o);%0A        %0A        assertThat(canMatch, is(false));%0A    %7D%0A    %0A    @Test%0A    public void canMatch_PropertyHolderObject_ReturnsTrue() throws Exception %7B%0A        Object o = mock(PropertyHolder.class);%0A%0A        boolean canMatch = MatcherType.PROPERTY_HOLDER.canMatch(o);%0A        %0A        assertThat(canMatch, is(true));%0A    %7D%0A    %0A    @SuppressWarnings(%22unchecked%22)%0A    @Test%0A    public void parseMatcher_ValidMapElement_ReturnsCorrectSpongeMatcher() throws SpongeMatcherParseException %7B%0A        StringElement element = StringElementParser.parseStringElement(%22%7B'test1':false,'test2':1,'test3':2f,%22%0A                + %22'test4':'LIQUID'%7D%22);%0A%0A        SpongeMatcher%3CPropertyHolder%3E matcher = MatcherType.PROPERTY_HOLDER.parseMatcher(element);%0A%0A        Property%3CString,Boolean%3E p1 = mock(Property.class);%0A        when(p1.getKey()).thenReturn(%22test1%22);%0A        when(p1.getValue()).thenReturn(false);%0A        Property%3CString, Integer%3E p2 = mock(Property.class);%0A        when(p2.getKey()).thenReturn(%22test2%22);%0A        when(p2.getValue()).thenReturn(1);%0A        Property%3CString, Double%3E p3 = mock(Property.class);%0A        when(p3.getKey()).thenReturn(%22test3%22);%0A        when(p3.getValue()).thenReturn(2.0);%0A        Property%3CString,MatterProperty.Matter%3E p4 = mock(Property.class);%0A        when(p4.getKey()).thenReturn(%22test4%22);%0A        when(p4.getValue()).thenReturn(MatterProperty.Matter.LIQUID);%0A        PropertyHolder holder1 = mock(PropertyHolder.class);%0A        when(holder1.getApplicableProperties()).thenReturn(ImmutableSet.of(p1, p2, p3, p4));%0A        assertThat(matcher, matches(holder1));%0A        %0A        Property%3CString,Boolean%3E p5 = mock(Property.class);%0A        when(p5.getKey()).thenReturn(%22test1%22);%0A        when(p5.getValue()).thenReturn(true);%0A        Property%3CString, Integer%3E p6 = mock(Property.class);%0A        when(p6.getKey()).thenReturn(%22test2%22);%0A        when(p6.getValue()).thenReturn(2);%0A        PropertyHolder holder2 = mock(PropertyHolder.class);%0A        when(holder2.getApplicableProperties()).thenReturn(ImmutableSet.of(p5, p6));%0A        assertThat(matcher, not(matches(holder2)));%0A    %7D%0A%7D%0A

Add tests for parsing PropertyHolder matchers