Back to project page klarna-on-demand-android.
The source code is released under:
Apache License
If you think the Android project klarna-on-demand-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.klarna.ondemand; //w ww. ja v a2s .c o m import junit.framework.TestCase; import java.lang.RuntimeException; public class ContextTest extends TestCase { @Override protected void setUp() throws java.lang.Exception { Context.setApiKey(null); } public void testSetApiKey(){ String apiKey = "my_key"; Context.setApiKey(apiKey); assertEquals(Context.getApiKey(), apiKey); } public void testGetApiKeyShouldThrowExceptionWhenThereIsNoApiKey() { try { Context.getApiKey(); fail("Exception not thrown"); } catch(RuntimeException e) { assertEquals(e.getMessage(), "You must set the API key first."); } } }