Archive for August, 2011

 

Google Maps API info

Aug 12, 2011 in Android, Google

API docs:

http://code.google.com/android/add-ons/google-apis/reference/index.html

Get a key from MD5 debug app signing certificate:

http://code.google.com/android/add-ons/google-apis/mapkey.html

Steps ..

— Get maps key

— Get example, HelloMapView
http://developer.android.com/guide/tutorials/views/hello-mapview.html

— Get Google Add-ons via the Eclipse Windows / Android SDK and ADB Manager

More detailed Example

http://mobiforge.com/developing/story/using-google-maps-android

jMock resources..

Aug 04, 2011 in Java

http://www.jmock.org

http://www.jmock.org/articles.html

http://www.jmock.org/cheat-sheet.html

http://www.jmock.org/cookbook.html

http://www.jmock.org/yoga.html

http://www.jmock.org/mocking-classes.html

This article explains how the mock setup class works
(I have been looking for this for at least 5 hours over 2 days..)

http://dancing-devil.blogspot.com/2011/04/mocking-java-system-class-and.html

To mock System.class and override the currentTimeMillis() method, do this:

Note: this works for protected methods.


Mockit.setUpMock(new MockSystem());

...

@MockClass(realClass = System.class)
public class MockSystem {
    @Mock
    public long currentTimeMillis() {
        ....
        return ....;
    }
}

To redefine methods using another way, including mocking static methods, use this:

public void setUp() throws Exception {
    super.setUp();
    Mockit.redefineMethods(MyClass.class, MockMyClass.class);
    ...
}

....

public static class MockMyClass {
    @Mock
    public static Something doSomething(...) {
        return Something ...;
    }
}