private void verifyGeneratedMethods(EntityDecoderBuilder<TestEntity> builder) {
    String methods = ClasspathResources.text("mongo-test/decode-methods.txt");

    builder
        .methods
        .values()
        .forEach(method -> Assert.assertThat(methods, CoreMatchers.containsString(method)));
  }
 /**
  * A local OBIX server has to be running in order to pass this test.
  *
  * <p>The IoTSYS System can be used for this: https://github.com/mjung85/iotsys/
  */
 @Test
 public void getLobbyShouldReturnEmptyLobbyOnlyWithResponseString() {
   String uri = "localhost/obix";
   CoapClient coapClient = new CoapClient(uri);
   // False, if the coap client is offline
   org.junit.Assume.assumeTrue(coapClient.ping());
   ObixLobby lobby = undecoratedCoapChannel.getLobby(uri);
   Assert.assertThat(lobby.getLobbyAsString(), CoreMatchers.containsString("href=\"obix/\""));
 }
Example #3
0
  @Test
  public void testCatCommand() throws Exception {
    Project project = projectFactory.createTempProject();
    File target = new File(project.getRoot().getFullyQualifiedName(), "test.java");
    target.createNewFile();

    FileResource<?> source = project.getRoot().getChild(target.getName()).reify(FileResource.class);
    source.setContents("public void test() {}");

    shellTest.execute("cat " + source.getFullyQualifiedName(), 5, TimeUnit.SECONDS);
    Assert.assertThat(shellTest.getStdOut(), CoreMatchers.containsString("test()"));
  }
Example #4
0
  @Test
  public void testCatColoredCommand() throws Exception {
    Project project = projectFactory.createTempProject();
    File target = new File(project.getRoot().getFullyQualifiedName(), "test.java");
    target.createNewFile();

    FileResource<?> source = project.getRoot().getChild(target.getName()).reify(FileResource.class);
    source.setContents("public void test() {}");

    shellTest.execute("cat " + source.getFullyQualifiedName() + " --color", 5, TimeUnit.SECONDS);
    // the string should be colors, so there are color codes between the statements
    Assert.assertThat(
        shellTest.getStdOut(), CoreMatchers.not(CoreMatchers.containsString("public void")));
  }
 @Test
 @OperateOnDeployment(STARTUP_SINGLETON_DEPLOYMENT)
 public void testStartupSingletonPostconstructSecurityNotPropagating() {
   try {
     deployer.deploy(STARTUP_SINGLETON_DEPLOYMENT);
     Assert.fail("Deployment should fail");
   } catch (Exception dex) {
     Throwable t = checkEjbException(dex);
     log.trace(
         "Expected deployment error because the Singleton has nosecurity context per itself",
         dex.getCause());
     Assert.assertThat(t.getMessage(), t.getMessage(), CoreMatchers.containsString("WFLYEJB0364"));
   } finally {
     deployer.undeploy(STARTUP_SINGLETON_DEPLOYMENT);
   }
 }
 @Test
 public void testSingletonPostconstructSecurityNotPropagating() throws Exception {
   SecurityClient client = SecurityClientFactory.getSecurityClient();
   client.setSimple("user1", "password1");
   client.login();
   try {
     WhoAmI bean = lookupSingletonUseBeanWithIdentity(); // To load the singleton
     bean.getCallerPrincipal();
     Assert.fail("Deployment should fail");
   } catch (Exception dex) {
     Throwable t = checkEjbException(dex);
     log.trace(
         "Expected deployment error because the Singleton has nosecurity context per itself",
         dex.getCause());
     Assert.assertThat(t.getMessage(), t.getMessage(), CoreMatchers.containsString("WFLYEJB0364"));
   } finally {
     client.logout();
   }
 }
Example #7
0
 @Then("^output should contain \"(.*?)\"$")
 public void output_should_contain(String expectedOutput) throws Throwable {
   String content = testClient.getAllFromSocket();
   assertThat(content, CoreMatchers.containsString(expectedOutput));
 }
  /**
   * ToString is difficult to test fully because there is no restriction on the format of the
   * returned String. At least it can be tested that a String is returned and that it contains the
   * name of a checked in guest.
   */
  @Test
  public void testToString() {
    hotel.checkIn(correctPassword, GUEST_NAME_1);

    assertThat(hotel.toString(), CoreMatchers.containsString(GUEST_NAME_1));
  }
Example #9
0
 public void verifySearchResult(String validResult) {
   String result = searchResult.getText();
   assertThat(result, CoreMatchers.containsString(validResult));
 }