### Question:
Aseprite { public static HashMap<String, Animation<TextureRegion>> fromAse(String key, AseFormat ase, Texture texture) { if (!ase.durationsDivisibleByShortest()) { throw new RuntimeException("One or more frame durations not divisible by shortest duration for " + key + ". To convert Asesprite animations to Gdx animations this is required."); } return createGdxAnimationMap(ase, key, texture); } private  Aseprite(); static HashMap<String, Animation<TextureRegion>> fromFile(String name); static HashMap<String, Animation<TextureRegion>> fromFile(String name, String key); static HashMap<String, com.badlogic.gdx.graphics.g2d.Animation<TextureRegion>> fromFile(String key, FileHandle jsonFile, FileHandle pngFile); static HashMap<String, Animation<TextureRegion>> fromAse(String key, AseFormat ase, Texture texture); static final float ASESPRITE_TO_GDX_DURATION; }### Answer:
@Test public void when_no_frametags_should_have_main_animation() { final Aseprite.AseFormat ase = createTestAse(50); Assert.assertNotNull(Aseprite.fromAse("test", ase, mock(Texture.class)).get("test")); }
@Test(expected = RuntimeException.class) public void when_frame_duration_not_multiple_of_shortest_duration_should_throw_exception() { final Aseprite.AseFormat ase = createTestAse(2, 3); Aseprite.fromAse("test", ase, mock(Texture.class)); }
@Test public void when_frame_has_longer_duration_should_repeat_frames() { final Aseprite.AseFormat ase = createTestAse(10,50); Animation<TextureRegion> animation = Aseprite.fromAse("test", ase, mock(Texture.class)).get("test"); Assert.assertEquals(6,animation.getKeyFrames().length); Assert.assertFalse( animation.getKeyFrames()[0].equals(animation.getKeyFrames()[1])); Assert.assertTrue( animation.getKeyFrames()[1].equals(animation.getKeyFrames()[2])); }
@Test public void when_multiple_tags_should_create_animation_for_each() { final Aseprite.AseFormat ase = createTestAse(50,50); createTestFrametag(ase,"jump",0,1); createTestFrametag(ase,"walk",0,1); final HashMap<String, Animation<TextureRegion>> animations = Aseprite.fromAse("test", ase, mock(Texture.class)); Assert.assertNotNull(animations.get("test")); Assert.assertNotNull(animations.get("test/jump")); Assert.assertNotNull(animations.get("test/walk")); }
@Test public void when_no_frames_should_have_no_animation() { final Aseprite.AseFormat ase = createTestAse(); Assert.assertNull(Aseprite.fromAse("test", ase, mock(Texture.class)).get("test")); }