Package com.iggroup.oss.sample.domain

Examples of com.iggroup.oss.sample.domain.Sample


    * Success test case for getSampleByReference
    */
   @Test
   public void testGetSampleByReference() {
      try {
         Sample sample = service.getSampleByReference("00001");
         assertTrue(sample.getReference().equalsIgnoreCase("00001"));
      } catch (Exception se) {
         assertTrue(false);
      }
   }
View Full Code Here


    */
   @Test
   public void testCreateSample() {

      try {
         service.createSample(new Sample(getAvailableRef(), "New Sample",
            SampleType.BOOK));
         assertTrue(true);
      } catch (Exception e) {
         assertTrue(false);
      }
View Full Code Here

    */
   @Test
   public void testDeleteSample() {
      String tempRef = getAvailableRef();
      try {
         service.createSample(new Sample(tempRef, "New Sample",
            SampleType.BOOK));
         service.deleteSample(tempRef);
      } catch (Exception e) {
         assertTrue(false);
      }
View Full Code Here

    */
   @Test
   public void testUpdateSample() {

      try {
         Sample sample = service.getSampleByReference("00001");
         sample.setName("New name");
         service.updateSample(sample);
      } catch (Exception e) {
         assertTrue(false);
      }

View Full Code Here

   @Profiled
   @Override
   public Sample getSampleByReference(String reference) {

      Sample sample;
      sample = sampleDAO.loadSample(reference);
      return sample;
   }
View Full Code Here

    * Default constructor. Sets up the "database"
    */
   public SampleDAO() {

      getDatabase().put("00001",
         new Sample("00001", "Wuthering Heights", SampleType.BOOK));
      getDatabase().put("00002",
         new Sample("00002", "Silas Marner", SampleType.BOOK));
      getDatabase().put("00003",
         new Sample("00003", "The Life of Pi", SampleType.BOOK));
      getDatabase().put("00004",
         new Sample("00004", "Gladiator", SampleType.DVD));
      getDatabase().put("00005",
         new Sample("00005", "Oliver Twist", SampleType.BOOK));

   }
View Full Code Here

    * @param reference the unique reference for a sample object
    * @return sample if found, else throws a NotFoundException
    */
   public Sample loadSample(String reference) {

      Sample sample = database.get(reference);

      if (sample == null) {
         throw new ReferenceNotFoundException(reference);
      }
      return sample;
View Full Code Here

TOP

Related Classes of com.iggroup.oss.sample.domain.Sample

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.