CSE116 All Homeworks

CSE116 All Homeworks - HOMEWORK ONE MOVIE QUEUE TESTS...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
HOMEWORK ONE – MOVIE QUEUE TESTS public class MovieQueueTests { private MovieQueue _q ; private Movie _m1 , _m2 , _m3 , _m4 , _m5 ; public MovieQueueTests() { _m1 = new Movie( "Star Wars" ); _m2 = new Movie( "Star Trek" ); _m3 = new Movie( "Spiderman" ); _m4 = new Movie( "Batman" ); _m5 = new Movie( "Avatar" ); } @Before public void setUp() throws Exception { _q = new MovieQueue(); _q .add( _m1 ); _q .add( _m2 ); _q .add( _m3 ); _q .add( _m4 ); _q .add( _m5 ); } @Test public void testFind_Star() { List<Movie> list = _q .find( "Star" ); boolean expected = true ; boolean actual = list.contains( _m1 _m2 ) && list.size() == 2; assertTrue ( "" , expected == actual); } @Test public void testFind_at_man() { List<Movie> list = _q .find( "at man" ); boolean expected = true ; boolean actual = list.contains( _m3 _m4 ) && list.contains( _m5 ) & list.size() == 3; assertTrue ( "" , expected == actual); } @Test public void testFind_star_Contains() { List<Movie> list = _q .find( "star" ); boolean expected = false ; boolean actual = list.contains( _m1 ) || list.contains( _m2 ); assertTrue ( "" , expected == actual); } @Test public void testFind_star_Size() { List<Movie> list = _q .find( "star" ); int expected = 0; int actual = list.size();
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
assertTrue ( "" , expected == actual); } @Test public void testFind_ar_Size() { List<Movie> list = _q .find( "ar" ); int expected = 3; int actual = list.size(); assertTrue ( "" , expected == actual); } @Test public void testFind_ar_Contains() { List<Movie> list = _q .find( "ar" ); boolean expected = true ; boolean actual = list.contains( _m1 ) && list.contains( _m2 list.contains( _m5 ); assertTrue ( "" , expected == actual); } @Test public void testFindEmpty() { List<Movie> list = _q .find( "" ); int expected = 0; int actual = list.size(); assertTrue ( "" , expected == actual); } @Test public void testFindSpace() { List<Movie> list = _q .find( " " ); int expected = 0; int actual = list.size(); assertTrue ( "" , expected == actual); } @Test public void testFind_er_re_Size() { List<Movie> list = _q .find( "er re" ); int expected = 2; int actual = list.size(); assertTrue ( "" , expected == actual); } @Test public
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 12/11/2011.

Page1 / 11

CSE116 All Homeworks - HOMEWORK ONE MOVIE QUEUE TESTS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online