Exemple #1
0
 /**
  * DyAlias can make an alias.
  *
  * @throws Exception If there is some problem inside
  */
 @Test
 public void makesAlias() throws Exception {
   final Aliases aliases = new DyBase().user(new URN("urn:test:12")).aliases();
   final String name = "walter";
   aliases.add(name);
   MatcherAssert.assertThat(aliases.check(name), Matchers.not(Matchers.isEmptyOrNullString()));
   final Alias alias = aliases.iterate().iterator().next();
   MatcherAssert.assertThat(alias, new Alias.HasName(Matchers.equalTo(name)));
   alias.photo(new URI("http://localhost#test"));
   MatcherAssert.assertThat(alias.photo().toString(), Matchers.containsString("#test"));
 }
Exemple #2
0
 /**
  * Get bout.
  *
  * @return Bout
  * @throws IOException If fails
  */
 public Bout bout() throws IOException {
   final Alias alias = new RqAlias(this.base, this).alias();
   final long number =
       Long.parseLong(new RqHeaders.Smart(new RqHeaders.Base(this)).single("X-Netbout-Bout"));
   final Bout bout;
   try {
     bout = alias.inbox().bout(number);
   } catch (final Inbox.BoutNotFoundException ex) {
     throw new HttpException(HttpURLConnection.HTTP_NOT_FOUND, ex);
   }
   if (!new Friends.Search(bout.friends()).exists(alias.name())) {
     throw new RsFailure(String.format("you're not in bout #%d", bout.number()));
   }
   return bout;
 }