gpt4 book ai didi

org.rembx.jeeshop.rest.WebApplicationException.getResponse()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 15:01:05 25 4
gpt4 key购买 nike

本文整理了Java中org.rembx.jeeshop.rest.WebApplicationException.getResponse()方法的一些代码示例,展示了WebApplicationException.getResponse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebApplicationException.getResponse()方法的具体详情如下:
包路径:org.rembx.jeeshop.rest.WebApplicationException
类名称:WebApplicationException
方法名:getResponse

WebApplicationException.getResponse介绍

暂无

代码示例

代码示例来源:origin: remibantos/jeeshop

@Test
public void delete_NotExistingEntry_shouldThrowNotFoundEx() {
  try {
    entityManager.getTransaction().begin();
    service.delete(666L);
    entityManager.getTransaction().commit();
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void delete_NotExistingEntry_shouldThrowNotFoundEx() {
  try {
    entityManager.getTransaction().begin();
    service.delete(666L);
    entityManager.getTransaction().commit();
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void delete_NotExistingEntry_shouldThrowNotFoundEx() {
  try {
    entityManager.getTransaction().begin();
    service.delete(666L);
    entityManager.getTransaction().commit();
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void sendTestEmail_shouldThrowNotFoundExWhenNoMailTemplateFoundForGivenParams() throws Exception {
  try {
    service.sendTestEmail(null, "unknown", "fr_FR", "toto@toto.com");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
    return;
  }
  fail("Should have thrown NOT_FOUND WebApplicationException");
}

代码示例来源:origin: remibantos/jeeshop

@Test
  public void delete_NotExistingEntry_shouldThrowNotFoundEx() {

    try {
      entityManager.getTransaction().begin();
      service.delete(666L);
      entityManager.getTransaction().commit();
      fail("should have thrown ex");
    } catch (WebApplicationException e) {
      assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
    }
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_withUnknownProductId_ShouldThrowNotFoundException() {
  try {
    service.find(9999L, null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void findCategories_shouldReturn404ExWhenCatalogNotFound() {
  try {
    service.findCategories(9999L, null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void findDiscounts_shouldReturn404ExWhenSKUNotFound() {
  try {
    service.findDiscounts(9999L);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void findProducts_shouldReturn404ExWhenCategoryNotFound() {
  try {
    service.findChildProducts(9999L, null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void resetPassword_shouldReturnUnauthorizedResponse_whenAuthenticatedUserDoesNotMatchLogin() throws Exception {
  try {
    when(sessionContextMock.isCallerInRole(JeeshopRoles.USER)).thenReturn(true);
    when(sessionContextMock.getCallerPrincipal()).thenReturn(new PrincipalImpl(testUser.firstUser().getLogin()));
    service.resetPassword("not_matching_login", null, null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void modifyUnknown_ShouldThrowNotFoundException() {
  MailTemplate detachedMailTemplate = new MailTemplate();
  detachedMailTemplate.setId(9999L);
  try {
    service.modify(detachedMailTemplate);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void modify_ShouldThrowUnauthorizedError_WhenAuthenticatedUserDoesNotMatchLogin() throws Exception {
  User detachedUserToModify = new User("test2@test.com", "test", "John", "Doe", "+33616161616", null, new Date(), "fr_FR", null);
  try {
    when(sessionContextMock.isCallerInRole(JeeshopRoles.USER)).thenReturn(true);
    when(sessionContextMock.getCallerPrincipal()).thenReturn(new PrincipalImpl(testUser.firstUser().getLogin()));
    service.modify(detachedUserToModify);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_withIdOfExpiredProduct_ShouldThrowForbiddenException() {
  try {
    service.find(testCatalog.anExpiredProduct().getId(), null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_withUnknownCategoryId_ShouldThrowNotFoundException() {
  try {
    service.find(9999L, null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_withIdOfDisableProduct_ShouldThrowForbiddenException() {
  try {
    service.find(testCatalog.aDisabledProduct().getId(), null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void modifyUnknownCategory_ShouldThrowNotFoundException() {
  Category detachedCategoryToModify = new Category(9999L, null, null, null, null, null);
  try {
    service.modify(detachedCategoryToModify);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void modifyUnknownSKU_ShouldThrowNotFoundException() {
  SKU detachedProductToModify = new SKU(9999L, null, null, null, null, null, null, null, null, null);
  try {
    service.modify(detachedProductToModify);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.NOT_FOUND);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_withIdOfExpiredCategory_ShouldThrowForbiddenException() {
  try {
    service.find(testCatalog.anExpiredCategory().getId(), null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_withIdOfDisableCategory_ShouldThrowForbiddenException() {
  try {
    service.find(testCatalog.aDisabledCategory().getId(), null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertThat(e.getResponse().getStatusInfo()).isEqualTo(Response.Status.FORBIDDEN);
  }
}

代码示例来源:origin: remibantos/jeeshop

@Test
public void find_NotVisibleCatalogItem_ShouldThrowForbiddenException() {
  try {
    instance.filterVisible(new Catalog(), null);
    fail("should have thrown ex");
  } catch (WebApplicationException e) {
    assertEquals(Response.Status.FORBIDDEN, e.getResponse().getStatusInfo());
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com