Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need pull #1

Open
wants to merge 216 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
98ffbf5
Fixed mProducerCounter to mConsumerCounter.
douglascraigschmidt May 13, 2014
79b6ed5
(re)fixed the project name to include the W1-A0 prefix.
douglascraigschmidt May 14, 2014
bec5722
Renamed mIterationCount to mTurnCountDown.
douglascraigschmidt May 14, 2014
6618744
Fixed "Lock" to be "Long".
douglascraigschmidt May 14, 2014
9a4a563
Added a new test for assignment 0.
douglascraigschmidt May 15, 2014
cfdc09d
Changed the project name for v2 of the unit tests.
douglascraigschmidt May 15, 2014
da62e22
Clarified the role of week-1-assignment-0-v2.
douglascraigschmidt May 15, 2014
1f712f0
Removed the BuggyBlockingQueue code and tests since it was confusing.
douglascraigschmidt May 15, 2014
25b7286
Added the grading driver for week-1-assignment-0.
douglascraigschmidt May 15, 2014
53a8c84
Renamed Assignment-Description.txt to Assessment-Description.txt.
douglascraigschmidt May 15, 2014
20a0ddb
Integrated the grading driver instructions.
douglascraigschmidt May 15, 2014
c7b5726
Fixed a typo.
douglascraigschmidt May 15, 2014
3170833
Enhanced the comments to clearly show how this relates to the Templat…
douglascraigschmidt May 15, 2014
c1c01aa
Updated the JUnit tests for SimpleAtomicLong.
douglascraigschmidt May 16, 2014
7cd4a36
Clarified several things.
douglascraigschmidt May 17, 2014
c79e3c2
Emphasized "green" checkmarks.
douglascraigschmidt May 17, 2014
28fc105
Clarified what the output means.
douglascraigschmidt May 17, 2014
10812ce
Yet more clarifications.
douglascraigschmidt May 17, 2014
52582e9
Clarified "TODO" comments.
douglascraigschmidt May 17, 2014
00abff2
Clarified the diagnosticsEnabled variable behavior and added more pat…
douglascraigschmidt May 17, 2014
e487ce8
Added new grading driver.
douglascraigschmidt May 17, 2014
f5a7afd
added SynchronizedQueue.java back.
douglascraigschmidt May 20, 2014
2a6a4fd
Cleaned things up a bit.
douglascraigschmidt May 21, 2014
596ab7e
moved souce files to non-default package
mawalker May 22, 2014
3001a28
added package declaration in each file
mawalker May 22, 2014
a2c5a8a
Added JUnit 4 and ./test/ to classpath and first JUnit test case
mawalker May 22, 2014
7b0ed0c
Renamed unit test files to avoid conflict with previous files
mawalker May 22, 2014
ab3b651
Updated the Unit Tests to have a 'AllTests' suite, and finished up th…
mawalker May 22, 2014
2287e1f
Updated SemaphoreUnitTest to use availablePermits()
mawalker May 22, 2014
933dac1
Added AvailablePermits Test
mawalker May 22, 2014
be86b3b
Merge branch 'master' of github.com:douglascraigschmidt/POSA-14
mawalker May 22, 2014
d4f795b
Added in availablePermits() method to better match Semaphore API
mawalker May 22, 2014
cbc40bd
Merge pull request #17 from mawalker/master
douglascraigschmidt May 22, 2014
2dfc9bc
Added JUnit tests for week-3-assignment-2.
douglascraigschmidt May 22, 2014
f5fe568
Added the POSA MOOC FAQ here.
douglascraigschmidt May 23, 2014
10a635c
Removed the FAQ since it doesn't belong here.
douglascraigschmidt May 23, 2014
45d3c5d
Updated the documentation.
douglascraigschmidt May 23, 2014
e341610
Fixed typo.
douglascraigschmidt May 23, 2014
a01e93d
Added the SimpleAtomicLong.java file back to the grading driver.
douglascraigschmidt May 23, 2014
4fa339d
Added a hint about the type of variable used for availablePermits.
douglascraigschmidt May 24, 2014
98cfa93
Moved the data members to the beginning of the SimpleSemaphore class …
douglascraigschmidt May 25, 2014
76d2983
The assignment is now ready for release!
douglascraigschmidt May 26, 2014
d368cd0
Added the grading-driver.
douglascraigschmidt May 26, 2014
731a656
Changed project name.
douglascraigschmidt May 26, 2014
dad43a8
Fixed a mistake.
douglascraigschmidt May 26, 2014
7e1400b
Fixed typo.
douglascraigschmidt May 26, 2014
9fa7366
Changed 12 to 24 to reflect the proper number of unit tests.
douglascraigschmidt May 28, 2014
14adb0e
Improved discussion of ConditionObject vs. Condition.
douglascraigschmidt May 28, 2014
a9caabd
Make constants final
Sardtok May 28, 2014
45859d4
Added the first cut of the DownloadApplication.
douglascraigschmidt May 29, 2014
e1c8c5a
Added final.
douglascraigschmidt May 29, 2014
cc243f9
Enable scrolling in Ping Pong activity
Sardtok May 29, 2014
6aadb55
Some fixes.
douglascraigschmidt May 29, 2014
37f8c0c
Fixed misuse of SimpleAtomicLong.
douglascraigschmidt May 30, 2014
d6f5e06
Update PalantirManagerUnitTest.java
dfcoffin May 30, 2014
f77846a
Merge pull request #25 from dfcoffin/master
douglascraigschmidt May 30, 2014
fe75a9f
Merge pull request #24 from Sardtok/patch-3
douglascraigschmidt May 30, 2014
2591e44
Merge pull request #23 from Sardtok/patch-2
douglascraigschmidt May 30, 2014
436c477
Applied patches.
douglascraigschmidt May 30, 2014
e81b019
Fixed output.
douglascraigschmidt May 30, 2014
b8819b2
Added week-4-assignment-3.
douglascraigschmidt May 30, 2014
6409cd0
Cleaned up the description a bit.
douglascraigschmidt May 30, 2014
eace39a
Added src and test directories.
douglascraigschmidt May 30, 2014
7823fa6
Improved the diagnostics.
douglascraigschmidt May 30, 2014
164b7e6
Added Mike'slatest enhancements.
douglascraigschmidt May 30, 2014
009a647
Fixed output.
douglascraigschmidt May 30, 2014
5b214fd
Moved latch down and renamed it to mLatch.
douglascraigschmidt May 30, 2014
69627d8
clarified that we need an *array* of semaphores.
douglascraigschmidt May 30, 2014
2920958
Yet more fixes.
douglascraigschmidt May 30, 2014
ceb8e37
Clarified that using an array of SimpleSemaphores is optional.
douglascraigschmidt May 31, 2014
953b741
Changed mooca to mocca.
douglascraigschmidt Jun 1, 2014
7fcace0
Fixed problem with WeakReference.
douglascraigschmidt Jun 1, 2014
b6cb29a
Renamed the package.
douglascraigschmidt Jun 1, 2014
75aff48
Fixed a typo.
douglascraigschmidt Jun 2, 2014
d4f5016
Zapped the WeakReference.
douglascraigschmidt Jun 2, 2014
771ea8b
Added Grading Driver.
douglascraigschmidt Jun 2, 2014
33175ea
Updated project name.
douglascraigschmidt Jun 2, 2014
dc5846a
Updated Assessment-Description.txt.
douglascraigschmidt Jun 2, 2014
4b32810
Updated comments.
douglascraigschmidt Jun 2, 2014
3016024
Fixed WeakReference issues.
douglascraigschmidt Jun 2, 2014
84694c1
Updated Assignment-Description.txt.
douglascraigschmidt Jun 2, 2014
55eef7c
Yet more fixes for DownloadHandler.
douglascraigschmidt Jun 2, 2014
e01d7d0
Added new check for a Runtime exception.
douglascraigschmidt Jun 3, 2014
5943e7b
Fixed mFailed.
douglascraigschmidt Jun 3, 2014
75795e8
Updated the resources file to add scroll view support.
douglascraigschmidt Jun 3, 2014
ecad486
Made UI prettier for ThreadedDownloads and DownloadApplication
mitchellgordon95 Jun 3, 2014
7af8540
Merge pull request #34 from mitchellgordon95/master
douglascraigschmidt Jun 4, 2014
0c13656
Added volatile fixes.
douglascraigschmidt Jun 4, 2014
5340819
Made the SimpleAtomicLong.java skeletons identical.
douglascraigschmidt Jun 4, 2014
6ceea8a
Removed the term "hook" since they aren't really being used as hook m…
douglascraigschmidt Jun 4, 2014
09b4ab5
Added/enhanced various files.
douglascraigschmidt Jun 5, 2014
269f0b9
Fixes.
douglascraigschmidt Jun 5, 2014
68a7544
fixed a comment.
douglascraigschmidt Jun 5, 2014
f1801b9
Made acquire() and release() private.
douglascraigschmidt Jun 5, 2014
559dcae
Enhanced the documentation.
douglascraigschmidt Jun 5, 2014
5910803
Added unit tests.
douglascraigschmidt Jun 6, 2014
5c9333f
Update PlayPingPong.java
mawalker Jun 7, 2014
833b0e1
updated Assignment Desc.
mawalker Jun 7, 2014
c3024ca
Merge pull request #44 from mawalker/master
douglascraigschmidt Jun 7, 2014
41c5d9a
Added bug fixes.
douglascraigschmidt Jun 7, 2014
cf68988
removed old project(s)
mawalker Jun 7, 2014
720b3c8
added 'hidden' files to removed list
mawalker Jun 7, 2014
331905f
new projects now import and compile & run properly
mawalker Jun 7, 2014
524d7c5
Merge branch 'master' of github.com:douglascraigschmidt/POSA-14
mawalker Jun 7, 2014
0b75166
Merge pull request #46 from mawalker/master
douglascraigschmidt Jun 7, 2014
772d2bd
Moved Assignment-Description.txt to the top directory.
douglascraigschmidt Jun 7, 2014
45ddf98
Added back the command-line variant.
douglascraigschmidt Jun 8, 2014
cdbd401
Updated the Assignment-Description.txt.
douglascraigschmidt Jun 8, 2014
2651006
Changed formatting to be left justified.
douglascraigschmidt Jun 8, 2014
032b587
Improved the documentation.
douglascraigschmidt Jun 9, 2014
20ea7e8
Changed ConditionObject to Condition.
douglascraigschmidt Jun 9, 2014
88af5a5
Added week-5-assignment-4 grading driver.
douglascraigschmidt Jun 10, 2014
59f462a
Fixed typo.
douglascraigschmidt Jun 10, 2014
88412f9
Added Assessment-Description.txt
douglascraigschmidt Jun 10, 2014
82f8543
Fixed typos.
douglascraigschmidt Jun 10, 2014
f89a0e8
fixed comment
douglascraigschmidt Jun 10, 2014
86fac99
Incorporated various suggestions for improvement.
douglascraigschmidt Jun 10, 2014
cc5f8b4
- Used centralized handling of platform type, avoiding duplications of
jeisfeld Jun 11, 2014
bab31f6
Merge pull request #49 from jeisfeld/master
douglascraigschmidt Jun 11, 2014
9d6f7e7
Merged improvements to the skeletons.
douglascraigschmidt Jun 11, 2014
4606ee5
Added week-6-assignment-5 skeletons.
douglascraigschmidt Jun 11, 2014
3dd5d40
Force adding project.properties.
douglascraigschmidt Jun 11, 2014
7c7aa06
Removed project.properties that was in the wrong place.
douglascraigschmidt Jun 11, 2014
3af71c9
Added back a {}.
douglascraigschmidt Jun 11, 2014
62f00ba
Fixed documentation.
douglascraigschmidt Jun 12, 2014
4985794
Fixed some issues that were confusing students.
douglascraigschmidt Jun 12, 2014
12a6f07
Enable offline "downloading" by default.
douglascraigschmidt Jun 13, 2014
5f10a2e
added a final.
douglascraigschmidt Jun 13, 2014
37db743
More fixes.
douglascraigschmidt Jun 15, 2014
804e077
Added the grading driver
douglascraigschmidt Jun 16, 2014
b07c1f4
Added the new GeoNamesApplication example that demonstrates the use o…
douglascraigschmidt Jun 17, 2014
154a256
Added project.properties.
douglascraigschmidt Jun 17, 2014
59cc39b
Removed .gitignore.
douglascraigschmidt Jun 17, 2014
b59c90b
Renamed project to differ.
douglascraigschmidt Jun 17, 2014
6bdafb1
Fixed this to add -grading.
douglascraigschmidt Jun 18, 2014
a9ddec5
Added project.properties.
douglascraigschmidt Jun 18, 2014
64da07c
Added a new example.
douglascraigschmidt Jun 18, 2014
22b4842
Added versions et al.
douglascraigschmidt Jun 18, 2014
043fd2c
Fixed problems with the lockscreen.
douglascraigschmidt Jun 19, 2014
aa918a5
Added WindowManager.
douglascraigschmidt Jun 19, 2014
29b679e
Fixed formatting.
douglascraigschmidt Jun 19, 2014
4512c95
Fixed this to refer to the grading version.
douglascraigschmidt Jun 19, 2014
8dc64ef
Added support for executeOnExecutor().
douglascraigschmidt Jun 19, 2014
cb0b558
Added peristence support via SharedPreferences.
douglascraigschmidt Jun 19, 2014
24c196e
Added makeIntent() factory method.
douglascraigschmidt Jun 19, 2014
0677bd6
Some minor fixes.
douglascraigschmidt Jun 21, 2014
cb3a686
Adding assignment 6
mitchellgordon95 Jun 21, 2014
f305bbf
Merge pull request #73 from mitchellgordon95/master
douglascraigschmidt Jun 21, 2014
65c25c8
Updated the Assignment-Description.txt file.
douglascraigschmidt Jun 21, 2014
71e1828
Removed apk's from .gitignore, added VulnCheck.apk
mitchellgordon95 Jun 21, 2014
bf4f6ab
Merge pull request #76 from mitchellgordon95/master
douglascraigschmidt Jun 21, 2014
9535a01
Pre-release fixes
mitchellgordon95 Jun 22, 2014
1bb160e
Merge pull request #82 from mitchellgordon95/master
douglascraigschmidt Jun 22, 2014
c4c4173
Added some fixes.
douglascraigschmidt Jun 22, 2014
726e6c7
Updated line numbers to reflect pre-release fixes
mitchellgordon95 Jun 23, 2014
c5e3380
Merge pull request #84 from mitchellgordon95/master
douglascraigschmidt Jun 23, 2014
0b75f49
Added import for import android.view.WindowManager;
douglascraigschmidt Jun 23, 2014
65f1745
Moved DownloadHandler definition a bit.
douglascraigschmidt Jun 24, 2014
d4586df
More DownloadHandler improvements.
douglascraigschmidt Jun 24, 2014
758aa22
Fixed dependencies.
douglascraigschmidt Jun 24, 2014
29955d1
Fixed the lock screen problem.
douglascraigschmidt Jun 24, 2014
02a0ca1
Zapped a "hint" that was OBE.
douglascraigschmidt Jun 24, 2014
651226d
Added more documentation for Executor thread pools.
douglascraigschmidt Jun 24, 2014
c75debc
Added new ACronymApplication.
douglascraigschmidt Jun 25, 2014
8df9212
Added new assignment.
douglascraigschmidt Jun 25, 2014
a8c6bb5
Fixed AndroidManifest.xml bug.
douglascraigschmidt Jun 26, 2014
6fab2a6
Fixed the appname.
douglascraigschmidt Jun 26, 2014
6cf24c8
Some fixes reported by students.
douglascraigschmidt Jun 26, 2014
761c541
fixed androidmanifest.xml header.
douglascraigschmidt Jun 26, 2014
00cc77a
Typo.
douglascraigschmidt Jun 26, 2014
5054084
fixed threadpooldownloadservice.
douglascraigschmidt Jun 26, 2014
98bc756
Made the Service run in its own process.
douglascraigschmidt Jun 26, 2014
f58520b
Refactoring.
douglascraigschmidt Jun 26, 2014
eeffaba
More tweaks.
douglascraigschmidt Jun 26, 2014
e9ed01a
Fixed ThreadPoolDownloadService.
douglascraigschmidt Jun 26, 2014
3384307
Fixed a race condition.
douglascraigschmidt Jun 28, 2014
540a6df
Added grading drivers.
douglascraigschmidt Jun 29, 2014
af9940b
Many improvements.
douglascraigschmidt Jul 1, 2014
016b912
Many improvements.
douglascraigschmidt Jul 1, 2014
6285fe5
More fixes.
douglascraigschmidt Jul 1, 2014
340d3fb
Added comments.
douglascraigschmidt Jul 1, 2014
0f92dba
Updated documentation.
douglascraigschmidt Jul 1, 2014
3369578
Added new factory.
douglascraigschmidt Jul 1, 2014
6246e1a
Added super cool Java reflection variant of GenericServiceConnection.
douglascraigschmidt Jul 1, 2014
9222915
Updates.
douglascraigschmidt Jul 1, 2014
d7d42f2
Fixes.
douglascraigschmidt Jul 1, 2014
2c63f70
Renamed DownloadUtils.java to AcronymDownloadUtils.java.
douglascraigschmidt Jul 1, 2014
14d1efa
refactoring.
douglascraigschmidt Jul 1, 2014
10dd040
Fixed comment.
douglascraigschmidt Jul 1, 2014
95301f3
More minor cleanup.
douglascraigschmidt Jul 1, 2014
8f5710e
Minor refactoring.
douglascraigschmidt Jul 1, 2014
14be0ac
Fixes for Grading.
douglascraigschmidt Jul 3, 2014
3d84ef4
Added AsyncTask.
douglascraigschmidt Jul 4, 2014
09fdeba
Finished the JSON ResponseHandler integration.
douglascraigschmidt Jul 4, 2014
8cb3f57
Minor commenting fixes.
douglascraigschmidt Jul 4, 2014
2e18f5d
More updates and refactoring.
douglascraigschmidt Jul 4, 2014
0e0f0f9
Refactored the code to only have a single ReplyMessenger in the Activ…
douglascraigschmidt Jul 5, 2014
6aa85ab
Added support for BinarySemaphore to illustrate how to use Java built…
douglascraigschmidt Jul 8, 2014
1684182
Fixed version info.
douglascraigschmidt Jul 11, 2014
a9aea45
fixed version info.
douglascraigschmidt Jul 11, 2014
d9bdb57
Added massive updates to the ThreadedDownloads application.
douglascraigschmidt Aug 4, 2014
a541286
Changed "ThreadedDownload" to "ThreadedDownloads".
douglascraigschmidt Aug 4, 2014
5802495
Fixes.
douglascraigschmidt Aug 4, 2014
435ef2c
Fixes.
douglascraigschmidt Aug 4, 2014
1fc987c
Various improvements.
douglascraigschmidt Aug 5, 2014
ef6b78c
Some fixes.
douglascraigschmidt Aug 28, 2014
6335b3b
Updates.
douglascraigschmidt Mar 25, 2015
f6d94c6
Updates.
douglascraigschmidt Apr 3, 2015
6fc2e79
Updates.
douglascraigschmidt Apr 4, 2015
c9b0718
UPdates.
douglascraigschmidt Apr 6, 2015
1c0bb86
UPdates.
douglascraigschmidt Apr 6, 2015
924b474
Updates.
douglascraigschmidt Apr 9, 2015
91126a7
Fixed some bugs.
douglascraigschmidt May 17, 2015
2d37294
Foo
douglascraigschmidt Sep 29, 2015
1f0aa09
Updates.
douglascraigschmidt Sep 29, 2015
03bb5dd
Updates.
douglascraigschmidt Oct 9, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ local.properties
#############################################################################

# Built application files
*.apk
*.ap_
#*.apk
#*.ap_

# Files for the Dalvik VM
*.dex
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
POSA-14
=======

This repository contains assignments and examples for the 2014 offering of the POSA MOOC (see www.coursera.org/course/posa for more information)
This repository contains assignments and examples for the 2014
offering of the POSA MOOC (see www.coursera.org/course/posa for more
information).
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions assignments/week-1-assignment-0-v2/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>W1-A0-SynchronizedQueueTestv2</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
98 changes: 98 additions & 0 deletions assignments/week-1-assignment-0-v2/Assignment-Description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Week 1: Programming Assignment 0 v2

[Note, this is a different skeleton for assignment 0, which fixes some
problems with the "official" version, provides better diagnostics, and
also has a cleaner design that uses the Template Method pattern to
decouple the test infrastructure from the student-supplied
code. However, it is NOT the offical version that will be peer graded
and is provided solely as a way for students to understand better how
concurrency and Java Threads work.]

In this (intentionally simple) initial assignment, you will use Java
Threads to test several implementations of the Java BlockingQueue
interface. The goal is to learn how to (1) create, (2) start, (3)
interrupt, and (4) wait for the completion of multiple Java Threads.
The test program also illustrates some problems that can occur if Java
Threads concurrently access an object that isn't synchronized
properly.

In the "src/edu/vuum/mocca" folder in this directory you'll find the
SynchronizedQueueImpl.java class, which contains the skeleton Java
code that you'll implement by completing the "TODO - You fill in here"
comments to provide a working solution. DO NOT CHANGE THE OVERALL
STRUCTURE OF THE SKELETON - just fill in the "TODO - You fill in here"
portions!!!

In particular, you'll need to do the following:

. Implement the "TODO" portions of the createThreads() and
startThreads() methods so that the two Java mProducer and mConsumer
Threads are created and started to run the mProducerRunnable and
mConsumerRunnable objects. Please keep the "TODO" comments in the
code so that peer reviewers can find them quickly during the
assessment phase.

. Implement the "TODO" portion of the interruptThreads() method, which
interrupts both the mProducer and mConsumer Threads so they will
shutdown.

. Implement the "TODO" portion of the "joinThreads()" method, which
waits for both Threads to exit before continuing with the test
(which is done for you by the testQueue() template method in the
SynchronizedQueue.java file).

. If you'd like to enable verbose debugging output please set the
diagnosticsEnabled flag in SynchronizedQueueImpl.java to true (it
defaults to false).

All the information needed to write this code is described in these
videos:

Section 1: Module 2: Part 1: Overview of Java Threads (Part 1)
Section 1: Module 2: Part 2: Overview of Java Threads (Part 2)
Section 1: Module 2: Part 3: Motivating Java Synchronization and Scheduling Mechanisms

Make sure to watch these videos and read all the supplied Java code
carefully prior to starting the assignment. These videos are
available at

https://class.coursera.org/posa-002/lecture

We'll also discuss this assignment specification (and later its
solution) in the POSA MOOC "Virtual Office Hours", which are described
in item #38 at the POSA MOOC FAQ available from

http://www.coursera.org/course/posa

The SynchronizerQueueTest.java file uses JUnit to run the tests. We
do this to automate the testing process and leverage the integration
of JUnit with Eclipse, as described here:

http://www.vogella.com/tutorials/JUnit/article.html#eclipse

When you first open the project in Eclipse, you might see compile
errors if JUnit is not included in your build path. To fix these
errors, open SynchronizedQueueTest.java, hover over "org.junit," and
click "Fix project setup." Make sure "Add JUnit 4 library to the
build path" is selected and then click "OK." At this point, the
compile errors should disappear!

To run the JUnit tests in Eclipse, right-click on
SynchronizedQueueTest.java and go to "Run As > JUnit Test". The JUnit
view will pop up in Eclipse and run the tests contained therein. All
tests should pass. The ArrayBlockingQueue will pass because your
testQueue method runs successfully. The tests for BuggyBlockingQueue
(which is an intentionally flawed class), should "pass" if some error
occurs while running testQueue (these errors are expected). If a test
passes a green-check mark will appear next to the test in the JUnit
view. As long as this JUnit test "passes" successfully your program
will be be consider "correct" for the purposes of assessing this
assignment.

If the tests run and "pass," you should see check-marks next to each
of the tests in the JUnit view. If you set the diagnosticsEnabled
flag to true then debugging output will be printed to the console as
the tests run. This debugging output is for informational purposes
only and have no bearing on whether your program is "correct." If the
tests run and "pass," you should see a green check-mark next to the
test in the JUnit view, which is all that matters.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public BuggyBlockingQueue(int initialSize) {
mList = new ArrayList<E>(initialSize);
}

/**
* Returns the number of elements in this queue.
*/
public int size() {
return mList.size();
}

/**
* Insert msg at the tail of the queue, but doesn't block if the
* queue is full.
Expand Down Expand Up @@ -119,7 +126,4 @@ public Iterator<E> iterator() {
public boolean isEmpty() {
return false;
}
public int size() {
return 0;
}
}
Loading