GarmadonMessageFilters { public static GarmadonMessageFilter.TypeFilter hasType(int type) { return new GarmadonMessageFilter.TypeFilter(type); } protected  GarmadonMessageFilters(); static GarmadonMessageFilter.ANY any(); static GarmadonMessageFilter.NONE none(); static GarmadonMessageFilter.HeaderFilter hasTag(Header.Tag tag); static GarmadonMessageFilter.HeaderFilter hasContainerId(String id); static GarmadonMessageFilter.HeaderFilter hasFramework(String framework); static GarmadonMessageFilter.TypeFilter hasType(int type); static GarmadonMessageFilter.NotFilter not(GarmadonMessageFilter other);  }
@Test public void TypeFilter_should_accept_only_designed_type(){ int type = GarmadonSerialization.TypeMarker.STATE_EVENT; GarmadonMessageFilter.TypeFilter filter = GarmadonMessageFilters.hasType(type); IntStream.of(20).forEach(i -> { int n = random.nextInt(); if(n != type) { assertThat(filter.accepts(n), is(false)); } }); assertThat(filter.accepts(type), is(true)); }