If you think the Android project gasp-gcm-client listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.cloudbees.gasp.model;
//fromwww.java2s.comimport junit.framework.TestCase;
/**
* Copyright (c) 2013 Mark Prichard, CloudBees
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/publicclass ModelObjectTest extends TestCase {
privatestaticfinalint testId = 1;
privatestaticfinalint testUserId = 1;
privatestaticfinalint testRestaurantId = 1;
privatestaticfinalint testStar = 1;
privatestaticfinal String testComment = "Test Comment";
privatestaticfinal String testName = "Test Name";
privatestaticfinal String testWebsite = "http://www.restaurant.com/";
privatestaticfinal String testPlacesId = "1234567890";
protectedvoid setUp() {}
protectedvoid tearDown() {}
publicvoid testReview() {
Review review = new Review();
review.setId(testId);
review.setRestaurant_id(testRestaurantId);
review.setUser_id(testUserId);
review.setComment(testComment);
review.setStar(testStar);
assertEquals(review.getId(), testId);
assertEquals(review.getRestaurant_id(), testRestaurantId);
assertEquals(review.getUser_id(), testUserId);
assertEquals(review.getStar(), testStar);
assertEquals(review.getComment(), testComment);
assertEquals(review.getRestaurant(), "/restaurants/" + testRestaurantId);
assertEquals(review.getUser(), "/users/" + testUserId);
assertEquals(review.toString(), "Review #" + testId + ": ("
+ testStar + " Stars) " + testComment);
}
publicvoid testRestaurant() {
Restaurant restaurant = new Restaurant();
restaurant.setId(testId);
restaurant.setName(testName);
restaurant.setWebsite(testWebsite);
restaurant.setPlacesId(testPlacesId);
assertEquals(restaurant.getId(), testId);
assertEquals(restaurant.getName(), testName);
assertEquals(restaurant.getWebsite(), testWebsite);
assertEquals(restaurant.getUrl(), "/restaurants/" + testId);
assertEquals(restaurant.getPlacesId(), testPlacesId);
assertEquals(restaurant.toString(), "Restaurant #" + testId + ": "
+ testName + " (" + testPlacesId + ")");
}
publicvoid testUser() {
User user = new User();
user.setId(testId);
user.setName(testName);
assertEquals(user.getId(), testId);
assertEquals(user.getName(), testName);
assertEquals(user.getUrl(), "/users/" + testId);
assertEquals(user.toString(), "User #" + testId + ": " + testName);
}
}