Codota Logo
ExceptionCauseMatcher.andMessage
Code IndexAdd Codota to your IDE (free)

How to use
andMessage
method
in
org.sonar.test.ExceptionCauseMatcher

Best Java code snippets using org.sonar.test.ExceptionCauseMatcher.andMessage (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

@Test
public void fail_if_invalid_remediation_function() {
 expectedException.expect(IllegalStateException.class);
 expectedException.expectMessage("Fail to load the rule with key [squid:1]");
 expectedException.expectCause(hasType(IllegalArgumentException.class)
  .andMessage("No enum constant org.sonar.api.server.debt.DebtRemediationFunction.Type.UNKNOWN"));
 load("" +
  "<rules>" +
  "  <rule>" +
  "    <key>1</key>" +
  "    <name>One</name>" +
  "    <description>Desc</description>" +
  "    <remediationFunction>UNKNOWN</remediationFunction>" +
  "  </rule>" +
  "</rules>");
}
origin: SonarSource/sonarqube

@Test
public void retrieveSystemInfo_throws_ISE_if_http_error() {
 server.enqueue(new MockResponse().setResponseCode(500));
 // initialize registration of process
 setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE);
 expectedException.expect(IllegalStateException.class);
 expectedException.expectMessage("Failed to call HTTP server of process " + ProcessId.COMPUTE_ENGINE);
 expectedException.expectCause(hasType(IOException.class)
  .andMessage(format("Server returned HTTP response code: 500 for URL: http://%s:%d/systemInfo", server.getHostName(), server.getPort())));
 underTest.retrieveSystemInfo();
}
origin: SonarSource/sonarqube

@Test
public void fail_if_unsupported_description_format() {
 String xml = "" +
  "<rules>" +
  "  <rule>" +
  "    <key>1</key>" +
  "    <name>One</name>" +
  "    <description>Desc</description>" +
  "    <descriptionFormat>UNKNOWN</descriptionFormat>" +
  "  </rule>" +
  "</rules>";
 expectedException.expect(IllegalStateException.class);
 expectedException.expectMessage("Fail to load the rule with key [squid:1]");
 expectedException.expectCause(hasType(IllegalArgumentException.class)
  .andMessage("No enum constant org.sonar.api.server.rule.RulesDefinitionXmlLoader.DescriptionFormat.UNKNOWN"));
 load(xml).rule("1");
}
origin: SonarSource/sonarqube

@Test
public void changeLogLevel_throws_ISE_if_http_error() {
 String message = "blah";
 server.enqueue(new MockResponse().setResponseCode(500).setBody(message));
 // initialize registration of process
 setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE);
 expectedException.expect(IllegalStateException.class);
 expectedException.expectMessage("Failed to call HTTP server of process " + ProcessId.COMPUTE_ENGINE);
 expectedException.expectCause(hasType(IOException.class)
  .andMessage(format("Failed to change log level in Compute Engine. Code was '500' and response was 'blah' for url " +
   "'http://%s:%s/changeLogLevel'", server.getHostName(), server.getPort())));
 underTest.changeLogLevel(LoggerLevel.DEBUG);
}
origin: SonarSource/sonarqube

@Test
public void loads_duplication_with_otherFileRef_throws_IAE_if_references_itself() {
 int line = 2;
 reportReader.putDuplications(FILE_1_REF, createDuplication(singleLineTextRange(line), createInProjectDuplicate(FILE_1_REF, line + 1)));
 expectedException.expect(VisitException.class);
 expectedException.expectCause(hasType(IllegalArgumentException.class).andMessage("file and otherFile references can not be the same"));
 underTest.execute(new TestComputationStepContext());
}
origin: SonarSource/sonarqube

@Test
public void loads_duplication_with_otherFileRef_throws_IAE_if_component_does_not_exist() {
 int line = 2;
 reportReader.putDuplications(FILE_1_REF, createDuplication(singleLineTextRange(line), createInProjectDuplicate(666, line + 1)));
 expectedException.expect(VisitException.class);
 expectedException.expectCause(hasType(IllegalArgumentException.class).andMessage("Component with ref '666' can't be found"));
 underTest.execute(new TestComputationStepContext());
}
origin: SonarSource/sonarqube

@Test
public void fail_on_project_without_children_already_having_computed_measure() {
 ReportComponent root = builder(PROJECT, ROOT_REF).build();
 treeRootHolder.setRoot(root);
 measureRepository.addRawMeasure(ROOT_REF, NCLOC_KEY, newMeasureBuilder().create(10));
 expectedException.expectCause(hasType(UnsupportedOperationException.class)
  .andMessage(String.format("A measure can only be set once for Component (ref=%s), Metric (key=%s)", ROOT_REF, NCLOC_KEY)));
 new PathAwareCrawler<>(formulaExecutorComponentVisitor(new FakeFormula()))
  .visit(root);
}
origin: SonarSource/sonarqube

@Test
public void fail_when_trying_to_compute_file_measure_already_existing_in_report() {
 ReportComponent root = builder(PROJECT, ROOT_REF)
  .addChildren(
   builder(Component.Type.FILE, FILE_1_REF).build())
  .build();
 treeRootHolder.setRoot(root);
 measureRepository.addRawMeasure(FILE_1_REF, NCLOC_KEY, newMeasureBuilder().create(2));
 expectedException.expectCause(hasType(UnsupportedOperationException.class)
  .andMessage(String.format("A measure can only be set once for Component (ref=%s), Metric (key=%s)", FILE_1_REF, NCLOC_KEY)));
 new PathAwareCrawler<>(formulaExecutorComponentVisitor(new FakeFormula()))
  .visit(root);
}
org.sonar.testExceptionCauseMatcherandMessage

Popular methods of ExceptionCauseMatcher

  • hasType
  • <init>

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • JLabel (javax.swing)
  • JPanel (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now