{"id":188,"date":"2011-09-12T01:20:30","date_gmt":"2011-09-12T08:20:30","guid":{"rendered":"http:\/\/blogs.unsw.edu.au\/infs1609\/?p=188"},"modified":"2011-09-12T01:37:57","modified_gmt":"2011-09-12T08:37:57","slug":"tutorial-week-8","status":"publish","type":"post","link":"https:\/\/blogs.unsw.edu.au\/infs1609\/blog\/2011\/09\/tutorial-week-8\/","title":{"rendered":"Tutorial &#8211; Week 8"},"content":{"rendered":"<p><strong>JUnit Testing<\/strong><\/p>\n<p>For the exercises this week, download the <a href=\"http:\/\/www.cse.unsw.edu.au\/~is1609\/11s2\/tuts\/diary-testing-junit-v2.zip\">diary-testing-junit-v2<\/a> project. These examples and exercises are based on chapter 6 of the textbook.<\/p>\n<ol>\n<li>Using the <em>diary-testing-junit-v2<\/em> project, create a method in <strong>DayTest<\/strong> to check that <strong>findSpace<\/strong> returns the value of <strong>10<\/strong> for a one-hour appointment if a day already has a single one-hour appointment at 9 a.m. You must first create the 9 a.m. appointment, then the 10 a.m appointment. Specify assertions for the results of both calls.<\/li>\n<li>Create a test to check that <strong>findSpace<\/strong> returns a value of <strong>-1<\/strong> if an attempt is made to find an appointment In a day that is already full.<\/li>\n<li>Create a test class that has <strong>Appointment<\/strong> as its reference class. Record separate test methods within It that check that the description and duration flelds of an <strong>Appointment<\/strong> object are initialised correctly following its creation.<\/li>\n<li>Create the following negative test in the <strong>DayTest<\/strong> class. Create a <strong>Day<\/strong> object, a one-hour <strong>Appointment<\/strong> object and a two-hour <strong>Appointment<\/strong> object. Make the one-hour appointment at 10 a.m. and then try to make the two-hour appointment at 9 a.m. Since this call to <strong>makeAppointment<\/strong> should fail, the value to put into the assertion is <strong>false<\/strong>. Now run the test. What is shown in the test results window?<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JUnit Testing For the exercises this week, download the diary-testing-junit-v2 project. These examples and exercises are based on chapter 6 of the textbook. Using the diary-testing-junit-v2 project, create a method in DayTest to check that findSpace returns the value of 10 for a one-hour appointment if a day already has a single one-hour appointment at [&hellip;]<\/p>\n","protected":false},"author":328,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/users\/328"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":3,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":193,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts\/188\/revisions\/193"}],"wp:attachment":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}