dynamic-animation/src/androidTest/java/androidx/dynamicanimation/tests/SpringTests.java
@Test
    public void testUndampedSpring() {
        final SpringAnimation anim = new SpringAnimation(mView1, DynamicAnimation.Y);
        anim.setSpring(new SpringForce(10).setDampingRatio(0));
        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
            @Override
            public void run() {
                // Expect exception for ending an undamped spring.
                try {
                    anim.skipToEnd();
                    fail("No exception is thrown when calling skipToEnd() on an undamped spring");
                } catch (UnsupportedOperationException e) {
                }
            }
        });

    }
/**
     * Try skipToEnd() on an undamped spring, and expect exception.
     */
Try skipToEnd() on an undamped spring, and expect exception.
Try skipToEnd () on an undamped spring and expect exception .
@Test
    public void testUndampedSpring() {
        final SpringAnimation anim = new SpringAnimation(mView1, DynamicAnimation.Y);
        anim.setSpring(new SpringForce(10).setDampingRatio(0));
        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
            @Override
            public void run() {
                try {
                    anim.skipToEnd();
                    fail("No exception is thrown when calling skipToEnd() on an undamped spring");
                } catch (UnsupportedOperationException e) {
                }
            }
        });
    }
@ Test public void testUndampedSpring ( ) { final SpringAnimation anim = new SpringAnimation ( mView1 , DynamicAnimation . Y ) ; anim . setSpring ( new SpringForce ( 10 ) . setDampingRatio ( 0 ) ) ; InstrumentationRegistry . getInstrumentation ( ) . runOnMainSync ( new Runnable ( ) { @ Override public void run ( ) { try { anim . skipToEnd ( ) ; fail ( "No exception is thrown when calling skipToEnd() on an undamped spring" ) ; } catch ( UnsupportedOperationException e ) { } } } ) ; }
Try skipToEnd() on an undamped spring, and expect exception.
Try skipToEnd () on an undamped spring and expect exception .
// Expect exception for ending an undamped spring.