コード例 #1
0
ファイル: BaseModelTest.java プロジェクト: malik491/coreApp
 /**
  * Test method for {@link
  * edu.depaul.se491.models.BaseModel#BaseModel(edu.depaul.se491.daos.DAOFactory,
  * edu.depaul.se491.beans.CredentialsBean)}.
  */
 @Test
 public void testBaseModel() {
   BaseModel model = new BaseModel(null, null);
   assertNotNull(model);
   assertNull(model.getResponseStatus());
   assertEquals("", model.getResponseMessage());
 }
コード例 #2
0
ファイル: BaseModelTest.java プロジェクト: malik491/coreApp
  @Test
  public void testSetResponseMessageAndStatus() {
    BaseModel model = new BaseModel(null, null);

    model.setResponseMessage("message");
    assertNotNull(model.getResponseMessage());
    assertEquals("message", model.getResponseMessage());

    model.setResponseStatus(Response.Status.OK);
    assertNotNull(model.getResponseStatus());
    assertEquals(Response.Status.OK, model.getResponseStatus());

    model.setResponseAndMeessageForDBError(new SQLException("exception test"));
    assertNotNull(model.getResponseMessage());
    assertEquals(BaseModel.GENERIC_SERVER_ERR_MSG, model.getResponseMessage());
    assertNotNull(model.getResponseStatus());
    assertEquals(Response.Status.INTERNAL_SERVER_ERROR, model.getResponseStatus());
  }