Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3623)

Issue 2199045: Boundary testing on local station lookup (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 7 months ago by jeremy.wadsack
Modified:
13 years, 7 months ago
Reviewers:
Michael Frederick
Base URL:
http://npr-android-app.googlecode.com/svn/trunk/
Visibility:
Public.

Description

These are some tests I put together to test the station lookup features for Issue 24. However, with these tests in place, nothing is failing, so this doesn't resolve issue 24 but it does provide coverage. Note that this includes a patch to Main that adds location listeners on startup. This is needed in testing so that calling getLastKnownLocation (in station lookup) doesn't return null. There's an extreme corner case where this could happen in real life (a user turns on the device, starts NPR and asks for local station without any other app looking at the location).

Patch Set 1 #

Total comments: 16

Patch Set 2 : Updates with edits, enhanced tests #

Patch Set 3 : Changed minTime in listeners to 1 minute #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+503 lines, -44 lines) Patch
Npr/src/org/npr/android/news/Main.java View 1 2 9 chunks +112 lines, -44 lines 0 comments Download
Npr_Test/src/org/npr/android/news/MainTest.java View 1 1 chunk +156 lines, -0 lines 2 comments Download
Npr_Test/src/org/npr/android/news/StationDetailsActivityTest.java View 1 1 chunk +127 lines, -0 lines 0 comments Download
Npr_Test/src/org/npr/android/news/StationSearchActivityTest.java View 1 1 chunk +108 lines, -0 lines 0 comments Download

Messages

Total messages: 6
jeremy.wadsack
13 years, 7 months ago (2010-09-23 01:42:10 UTC) #1
Michael Frederick
Fantastic! Mostly pedantic comments below. Question: Do you use Eclipse? If so, would it be ...
13 years, 7 months ago (2010-09-23 17:02:31 UTC) #2
jeremy.wadsack
Michael - I do use Eclipse and I created a format and uploaded it to ...
13 years, 7 months ago (2010-09-23 17:07:50 UTC) #3
jeremy.wadsack
Updated to reflect change requests, including formatting. MainTest now tests to make sure that the ...
13 years, 7 months ago (2010-09-23 23:53:18 UTC) #4
Michael Frederick
LGTM Great work! Just a few nitpicks. http://codereview.appspot.com/2199045/diff/1/Npr/src/org/npr/android/news/Main.java File Npr/src/org/npr/android/news/Main.java (right): http://codereview.appspot.com/2199045/diff/1/Npr/src/org/npr/android/news/Main.java#newcode73 Npr/src/org/npr/android/news/Main.java:73: private static ...
13 years, 7 months ago (2010-09-24 16:04:59 UTC) #5
jeremy.wadsack
13 years, 7 months ago (2010-09-24 23:52:02 UTC) #6
I'll make the format fix and commit this weekend or on Monday.

http://codereview.appspot.com/2199045/diff/1/Npr/src/org/npr/android/news/Mai...
File Npr/src/org/npr/android/news/Main.java (right):

http://codereview.appspot.com/2199045/diff/1/Npr/src/org/npr/android/news/Mai...
Npr/src/org/npr/android/news/Main.java:73: private static final int
MSG_CANCEL_LOCATION_LISTENERS = 2;
On 2010/09/24 16:05:00, Michael Frederick wrote:
> On 2010/09/23 23:53:18, jeremy.wadsack wrote:
> > On 2010/09/23 17:02:32, Michael Frederick wrote:
> > > While you're here, can you add constants for the others? Also, I usually
> > prefer
> > > enums in this case, since you get the ordinal value for free, and it's
more
> > > readable.
> > 
> > Will do. I didn't want to change existing code too much, but wanted to
present
> > an example. :)
> > 
> > I also prefer enums but apparently Java programmers generally don't like
them
> > (which is the Android SDK full if int constants instead of enums?). In this
> case
> > though, using an enum might not gain us much as we'd have to cast it and int
> to
> > store it in the message and cast it from and int to check it.
> > 
> > 
> 
> Enum#ordinal returns a unique int for that value.

But that's a method call and a case expression must be a constant expression. To
do that I would need to change the switch to a series of if/else statements. I'm
not sure we're gaining anything.

http://codereview.appspot.com/2199045/diff/10001/Npr_Test/src/org/npr/android...
File Npr_Test/src/org/npr/android/news/MainTest.java (right):

http://codereview.appspot.com/2199045/diff/10001/Npr_Test/src/org/npr/android...
Npr_Test/src/org/npr/android/news/MainTest.java:69: .e(
On 2010/09/24 16:05:00, Michael Frederick wrote:
> Personally, I find this less readable (having the method on a separate line).
Is
> this personal style, or a code auto-format?

Ugh, yes. That's bad. It's something in the formatter in Eclipse. I'll fix it
before I commit. I'd love a new formatter that works exactly right. :)
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b