There may be another way. The comments on the sample's MainActivity read:
* The first thing you need to do is get your hands on your public key.
* Update the BASE64_PUBLIC_KEY constant below with your encoded public key,
* which you can find on the
* <a href="http://market.android.com/publish/editProfile">Edit Profile</a>
* page of the Market publisher site.
* <p>
* Log in with the same account on your Cupcake (1.5) or higher phone or
* your FroYo (2.2) emulator with the Google add-ons installed. Change the
* test response on the Edit Profile page, press Save, and see how this
* application responds when you check your license.
And when you log into http://market.android.com/publish/editProfile you will see an option for changing the License Test Response
:

Textually saying:
This License Test Response will be
sent to devices using @gmail.com
or the Test Accounts listed above for
applications you have uploaded to
Market. Additionally, this account
(but not the Test Accounts) will
receive this response for applications
that have not yet been uploaded to
Market.
If you click that selection list, you will see different options:

I guess all you have to do, for that initial sample LVL tutorial program, is change the response from Respond normally
to LICENSED
or any other setting you want to test.
UPDATE: It turns out that the above measure is insufficient. I still get the NOT_MARKET_MANAGED
error. I guess that "Market Licensing Example" must be uploaded as previous answers suggested. Note, however, that it cannot be the debug version:

Oh, and you can't really upload that "Market Licensing Example" as is. You must at least change the name of the package:

I can see how Google's sample/example system could be improved to become more developer-friendly...
Weird. After uploading the application (just uploading and saving draft, not filling any other required fields), the "Market Licensing Example" stops issuing the NOT_MARKET_MANAGED
error, despite the fact that clearly selected NOT_LICENSED
. Instead it responds with the message Allow the user access
. I also tried setting (for test & learning purposes) it to ERROR_SERVER_FAILURE
but I get the same Allow the user access
message.
Why?