Package com.wesabe.api.accounts.params

Examples of com.wesabe.api.accounts.params.BooleanParam


  public static class Parsing_A_Invalid_Boolean {
   
    @Test
    public void itThrowsA400BadRequestWebApplicationException() throws Exception {
      try {
        new BooleanParam("X#H");
        fail("should have thrown a WebApplicationException but didn't");
      } catch (WebApplicationException e) {
        assertEquals(400, e.getResponse().getStatus());
        assertEquals("Invalid parameter: X#H (X#H is neither true nor false).", e.getResponse().getEntity());
      }
View Full Code Here


      when(account.isActive()).thenReturn(true);
    }
   
    @Test
    public void itArchivesTheAccount() {
      accountResource.update(user, Locale.ENGLISH, new IntegerParam("1"), null, null, new BooleanParam("true"));
      verify(account).setStatus(AccountStatus.ARCHIVED);
      verify(accountDAO).update(account);
    }
View Full Code Here

      when(account.isActive()).thenReturn(false);
    }
   
    @Test
    public void itDoesNothing() {
      accountResource.update(user, Locale.ENGLISH, new IntegerParam("1"), null, null, new BooleanParam("true"));
      verify(account, never()).setStatus(AccountStatus.ARCHIVED);
      verify(accountDAO, never()).update(account);
    }
View Full Code Here

      when(account.isActive()).thenReturn(false);
    }
   
    @Test
    public void itActivatesTheAccount() {
      accountResource.update(user, Locale.ENGLISH, new IntegerParam("1"), null, null, new BooleanParam("false"));
      verify(account).setStatus(AccountStatus.ACTIVE);
      verify(accountDAO).update(account);
    }
View Full Code Here

      when(account.isActive()).thenReturn(true);
    }
   
    @Test
    public void itDoesNothing() {
      accountResource.update(user, Locale.ENGLISH, new IntegerParam("1"), null, null, new BooleanParam("false"));
      verify(account, never()).setStatus(AccountStatus.ARCHIVED);
      verify(accountDAO, never()).update(account);
    }
View Full Code Here

    }
   
    @Test
    public void itRespondsWithBadRequest() {
      try {
        accountResource.update(user, Locale.ENGLISH, new IntegerParam("1"), null, null, new BooleanParam("false"));
        fail("Expected Bad Request exception, got none");
      } catch (WebApplicationException ex) {
        assertThat(ex.getResponse().getStatus()).isEqualTo(Status.BAD_REQUEST.getStatusCode());
      }
    }
View Full Code Here

    }
   
    @Test
    public void itRespondsWithBadRequest() {
      try {
        accountResource.update(user, Locale.ENGLISH, new IntegerParam("1"), null, null, new BooleanParam("true"));
        fail("Expected Bad Request exception, got none");
      } catch (WebApplicationException ex) {
        assertThat(ex.getResponse().getStatus()).isEqualTo(Status.BAD_REQUEST.getStatusCode());
      }
    }
View Full Code Here

      when(context.getIntervalSummarizer().summarize(Mockito.any(Iterable.class), Mockito.any(Interval.class), Mockito.any(IntervalType.class), Mockito.any(Currency.class), Mockito.any(Set.class))).thenReturn(results);

      this.representation = mock(XmlsonObject.class);
      when(context.getIntervalSummaryPresenter().present(Mockito.any(ImmutableMap.class), Mockito.any(Locale.class))).thenReturn(representation);
     
      this.uneditedOnly = new BooleanParam("false");
     
      this.accountUris = ImmutableSet.of(new UriParam("/accounts/1"));
     
      this.tagUris = ImmutableSet.of("/tags/food");
     
View Full Code Here

TOP

Related Classes of com.wesabe.api.accounts.params.BooleanParam

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.