/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. */ public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. * * @deprecated use {@code org.hamcrest.junit.ErrorCollector.checkThat()} */ @Deprecated public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
@Test public void default_instance() { Set<Class<? extends Templates>> templates = querydsl.getSubTypesOf(Templates.class); Set<Class<? extends Templates>> moduleSpecific = getAll(templates, MODULE_SPECIFIC); for (Class<? extends Templates> template : moduleSpecific) { try { Templates defaultInstance = (Templates) template.getField("DEFAULT").get(null); errorCollector.checkThat(defaultInstance, instanceOf(template)); } catch (Exception ex) { errorCollector.addError(ex); } } }
@Test public void isThreadAlertingIsTrueWhileExecuting() { execute(() -> errorCollector.checkThat(isThreadAlerting(), is(true))); }
/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. */ public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. */ public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. */ public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. */ public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
/** * Adds a failure to the table if {@code matcher} does not match {@code value}. * Execution continues, but the test will fail at the end if the match fails. */ public <T> void checkThat(final T value, final Matcher<T> matcher) { checkThat("", value, matcher); }
@Test @Override public void invalidServiceParameter() throws XmlException { XmlObject getDataAvailabilityDocument = XmlObject.Factory .parse("<sos:GetDataAvailability xmlns:sos=\"http://www.opengis.net/sos/2.0\" service=\"INVALID\" version=\"2.0.0\"/>"); Response res = soap(getDataAvailabilityDocument); getErrors().checkThat(res.getStatus(), is(400)); getErrors() .checkThat(res.asNode(), is(invalidServiceParameterValueExceptionFault("INVALID"))); } }
@Test @Override public void emptyServiceParameter() throws XmlException { XmlObject getDataAvailabilityDocument = XmlObject.Factory .parse("<sos:GetDataAvailability xmlns:sos=\"http://www.opengis.net/sos/2.0\" service=\"\" version=\"2.0.0\"/>"); Response res = soap(getDataAvailabilityDocument); getErrors().checkThat(res.getStatus(), is(400)); getErrors() .checkThat(res.asNode(), is(missingServiceParameterValueExceptionFault())); }
private static void checkAllConnector(FixedConnectorsComponentProperties fccp, ErrorCollector collector, Set<PropertyPathConnector> allConnectors) { for (PropertyPathConnector connector : allConnectors) { NamedThing property = fccp.getProperty(connector.getPropertyPath()); collector.checkThat(property, notNullValue()); collector.checkThat(property, anyOf(instanceOf(Property.class), instanceOf(SchemaProperties.class))); } } }
private void checkNormalSuccessors(SSACFG cfg, PrunedCFG<SSAInstruction, ISSABasicBlock> prunedCfg, ISSABasicBlock block) { LinkedHashSet<ISSABasicBlock> normalSuccessorCfg = new LinkedHashSet<>(cfg.getNormalSuccessors(block)); LinkedHashSet<ISSABasicBlock> normalSuccessorPruned = new LinkedHashSet<>(prunedCfg.getNormalSuccessors(block)); collector.checkThat("", normalSuccessorPruned, equalTo(normalSuccessorCfg)); }
private void checkThrownExceptions(CGNode node, IntraproceduralExceptionAnalysis analysis) { Set<TypeReference> exceptions = analysis.getExceptions(); String text = "Number of thrown exceptions did not match in " + node.getMethod().getName().toString() + ". The follwoing exceptions were thrown: " + exceptions.toString(); if (node.getMethod().getName().toString().matches("invokeSingle.*") && (!node.getMethod().getName().toString().equals("invokeSingleRecursive2Helper")) && (!node.getMethod().getName().toString().equals("invokeSinglePassThrough"))) { collector.checkThat(text, exceptions.size(), equalTo(1)); } else { collector.checkThat(text, exceptions.size(), equalTo(0)); } }
@Test @Override public void missingServiceParameter() throws XmlException { GetCapabilitiesDocument getCapabilitiesDocument = GetCapabilitiesDocument.Factory.newInstance(); GetCapabilitiesType getCapabilitiesType = getCapabilitiesDocument .addNewGetCapabilities2(); getCapabilitiesType.addNewAcceptVersions().addNewVersion() .setStringValue("2.0.0"); Response res = soap(getCapabilitiesDocument); getErrors().checkThat(res.getStatus(), is(200)); // TODO check if response is a sos:Capabilities document }