target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testPlay() { Music theme = mock(Music.class); actor.play(theme); verify(theme, times(1)).play(); verify(theme, times(1)).setLooping(true); }
public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } void play(Music theme); @Override void dispose(); }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } void play(Music theme); @Override void dispose(); }
@Test public void getUnsupportedProperty() { Object object = new Object(); assertThat(config.get(new Property<Object>(Object.class, "", object) {})) .isEqualTo(object); }
@Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; value = getList(listProperty); } else { value =...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
@Test public void testPlaySecond() { Music first = mock(Music.class); Music second = mock(Music.class); actor.play(first); reset(first); actor.play(second); verify(first, times(1)).stop(); verify(second, times(1)).play(); verify(second, times(1)).setLooping(true); }
public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } void play(Music theme); @Override void dispose(); }
MusicActor extends Actor implements Disposable { public void play(Music theme) { if (this.theme != null) { this.theme.stop(); } this.theme = theme; this.theme.setLooping(true); this.theme.play(); } void play(Music theme); @Override void dispose(); }
@Test public void disposeUnknown() throws Exception { assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); assertThatCode(() -> actor.ballDisposed(receptor, Direction.LEFT, new Marble(MarbleType.BLUE)) ).doesNotThrowAnyException(); }
@Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { Actor actor = getContext().actor(marble); if (actor != null) { actor.remove(); } }
ReceptorActor extends TileableActor<Receptor> implements ReceptorListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { Actor actor = getContext().actor(marble); if (actor != null) { actor.remove(); } } }
ReceptorActor extends TileableActor<Receptor> implements ReceptorListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { Actor actor = getContext().actor(marble); if (actor != null) { actor.remove(); } } ReceptorActor(Receptor receptor, ActorContext context); }
ReceptorActor extends TileableActor<Receptor> implements ReceptorListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { Actor actor = getContext().actor(marble); if (actor != null) { actor.remove(); } } ReceptorActor(Receptor receptor, ActorContext context); @Override Tex...
ReceptorActor extends TileableActor<Receptor> implements ReceptorListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { Actor actor = getContext().actor(marble); if (actor != null) { actor.remove(); } } ReceptorActor(Receptor receptor, ActorContext context); @Override Tex...
@Test public void testSpawn() throws Exception { assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); latch = new CountDownLatch(2); TileableListener listener = spy(new TileableListener() { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { latch.countDown(); } }); nexus.addLi...
@Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 center = getCenter(); Vector2 target = getTarget(direction); actor.setPositi...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
@Test public void testInvalidDirection() throws Exception { assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); assertThatThrownBy(() -> actor.ballAccepted(nexus, Direction.TOP, new Marble(MarbleType.BLUE)) ).isInstanceOf(IllegalArgumentException.class); }
@Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 center = getCenter(); Vector2 target = getTarget(direction); actor.setPositi...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
NexusActor extends TransportingActor<Nexus> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = MarbleActor.get(marble, getContext()); addActor(actor); Nexus nexus = getTileable(); Vector2 origin = getOrigin(direction); Vector2 ce...
@Test public void testFilterJoker() throws Exception { assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); latch = new CountDownLatch(2); Marble marble = new Marble(MarbleType.JOKER); JokerMarbleActor jokerActor = new JokerMarbleActor(marble, context); jokerActor.addActor(new Actor()); context.register(marble, joker...
@Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = (MarbleActor) getContext().actor(marble); Vector2 origin = stageToLocalCoordinates(actor.localToStageCoordinates( new Vector2(actor.getWidth() / 2.f, actor.getHeight() / 2.f))); prepareActor(actor, direction,...
TrackActor extends TransportingActor<Track> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = (MarbleActor) getContext().actor(marble); Vector2 origin = stageToLocalCoordinates(actor.localToStageCoordinates( new Vector2(actor.ge...
TrackActor extends TransportingActor<Track> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = (MarbleActor) getContext().actor(marble); Vector2 origin = stageToLocalCoordinates(actor.localToStageCoordinates( new Vector2(actor.ge...
TrackActor extends TransportingActor<Track> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = (MarbleActor) getContext().actor(marble); Vector2 origin = stageToLocalCoordinates(actor.localToStageCoordinates( new Vector2(actor.ge...
TrackActor extends TransportingActor<Track> implements TileableListener { @Override public void ballAccepted(Tileable tileable, Direction direction, Marble marble) { MarbleActor actor = (MarbleActor) getContext().actor(marble); Vector2 origin = stageToLocalCoordinates(actor.localToStageCoordinates( new Vector2(actor.ge...
@Test public void testPush() throws Exception { Actor screen = spy(new Actor()); latch = new CountDownLatch(1); app.postRunnable(() -> { actor.push(screen); latch.countDown(); }); assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); Thread.sleep(500); verify(screen, atLeastOnce()).draw(any(), anyFloat()); verify(scre...
public void push(Actor screen) { Action runnable = Actions.run(() -> { add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); }
ScreenStack extends Stack { public void push(Actor screen) { Action runnable = Actions.run(() -> { add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } }
ScreenStack extends Stack { public void push(Actor screen) { Action runnable = Actions.run(() -> { add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } }
ScreenStack extends Stack { public void push(Actor screen) { Action runnable = Actions.run(() -> { add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } void replace(Actor screen); void push(Actor screen); void pop(int n); @Override void act(float deltaTime); }
ScreenStack extends Stack { public void push(Actor screen) { Action runnable = Actions.run(() -> { add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } void replace(Actor screen); void push(Actor screen); void pop(int n); @Override void act(float deltaTime); }
@Test public void testReplace() throws Exception { Actor screenA = spy(new Actor()); Actor screenB = spy(new Actor()); latch = new CountDownLatch(1); app.postRunnable(() -> { actor.push(screenA); actor.replace(screenB); latch.countDown(); }); assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); reset(screenA); Thread...
public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } void replace(Actor screen); void push(Actor screen); void pop(int n); @Override void act(float d...
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } void replace(Actor screen); void push(Actor screen); void pop(int n); @Override void act(float d...
@Test public void testPopNoChildren() throws Exception { latch = new CountDownLatch(1); app.postRunnable(() -> { actor.pop(1); latch.countDown(); }); assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); Thread.sleep(500); assertThat(actor.hasChildren()).isFalse(); }
public void pop(int n) { addAction(Actions.run(() -> { if (!hasChildren() || n == 0) { return; } SnapshotArray<Actor> children = getChildren(); int size = children.size; children.removeRange(Math.max(0, size - n), size - 1); if (size - n > 0) { getStage().setKeyboardFocus(children.peek()); } })); }
ScreenStack extends Stack { public void pop(int n) { addAction(Actions.run(() -> { if (!hasChildren() || n == 0) { return; } SnapshotArray<Actor> children = getChildren(); int size = children.size; children.removeRange(Math.max(0, size - n), size - 1); if (size - n > 0) { getStage().setKeyboardFocus(children.peek()); }...
ScreenStack extends Stack { public void pop(int n) { addAction(Actions.run(() -> { if (!hasChildren() || n == 0) { return; } SnapshotArray<Actor> children = getChildren(); int size = children.size; children.removeRange(Math.max(0, size - n), size - 1); if (size - n > 0) { getStage().setKeyboardFocus(children.peek()); }...
ScreenStack extends Stack { public void pop(int n) { addAction(Actions.run(() -> { if (!hasChildren() || n == 0) { return; } SnapshotArray<Actor> children = getChildren(); int size = children.size; children.removeRange(Math.max(0, size - n), size - 1); if (size - n > 0) { getStage().setKeyboardFocus(children.peek()); }...
ScreenStack extends Stack { public void pop(int n) { addAction(Actions.run(() -> { if (!hasChildren() || n == 0) { return; } SnapshotArray<Actor> children = getChildren(); int size = children.size; children.removeRange(Math.max(0, size - n), size - 1); if (size - n > 0) { getStage().setKeyboardFocus(children.peek()); }...
@Test @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") public void testActionsNoStage() throws Exception { Graphics real = Gdx.graphics; Gdx.graphics = spy(real); latch = new CountDownLatch(1); app.postRunnable(() -> { actor.remove(); actor.addAction(Actions.delay(1)); actor.act(1); latch.countDown(); });...
@Override public void act(float deltaTime) { Array<Action> actions = this.getActions(); Stage stage = getStage(); if (actions.size > 0) { if (stage != null) { if (stage.getActionsRequestRendering()) { Gdx.graphics.requestRendering(); } } for (int i = 0; i < actions.size; i++) { Action action = actions.get(i); if (actio...
ScreenStack extends Stack { @Override public void act(float deltaTime) { Array<Action> actions = this.getActions(); Stage stage = getStage(); if (actions.size > 0) { if (stage != null) { if (stage.getActionsRequestRendering()) { Gdx.graphics.requestRendering(); } } for (int i = 0; i < actions.size; i++) { Action action...
ScreenStack extends Stack { @Override public void act(float deltaTime) { Array<Action> actions = this.getActions(); Stage stage = getStage(); if (actions.size > 0) { if (stage != null) { if (stage.getActionsRequestRendering()) { Gdx.graphics.requestRendering(); } } for (int i = 0; i < actions.size; i++) { Action action...
ScreenStack extends Stack { @Override public void act(float deltaTime) { Array<Action> actions = this.getActions(); Stage stage = getStage(); if (actions.size > 0) { if (stage != null) { if (stage.getActionsRequestRendering()) { Gdx.graphics.requestRendering(); } } for (int i = 0; i < actions.size; i++) { Action action...
ScreenStack extends Stack { @Override public void act(float deltaTime) { Array<Action> actions = this.getActions(); Stage stage = getStage(); if (actions.size > 0) { if (stage != null) { if (stage.getActionsRequestRendering()) { Gdx.graphics.requestRendering(); } } for (int i = 0; i < actions.size; i++) { Action action...
@Test public void push() { Actor screen = mock(Actor.class); stage.push(screen); verify(stack).push(eq(screen)); }
public void push(Actor screen) { stack.push(screen); }
StackableStage extends Stage { public void push(Actor screen) { stack.push(screen); } }
StackableStage extends Stage { public void push(Actor screen) { stack.push(screen); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); }
StackableStage extends Stage { public void push(Actor screen) { stack.push(screen); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); ScreenStack getScreenStack(); void replace(Actor screen); void push(Actor screen); void pop(int n); }
StackableStage extends Stage { public void push(Actor screen) { stack.push(screen); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); ScreenStack getScreenStack(); void replace(Actor screen); void push(Actor screen); void pop(int n); }
@Test public void propertyExists() throws Exception { when(api.getStringValueOf("test")).thenReturn(""); assertThat(config.exists(new StringProperty("test", ""))).isTrue(); }
@Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); @Override @SuppressWarnings("unchecked") T get(Prop...
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); @Override @SuppressWarnings("unchecked") T get(Prop...
@Test public void replace() { Actor screen = mock(Actor.class); stage.replace(screen); verify(stack).replace(eq(screen)); }
public void replace(Actor screen) { stack.replace(screen); }
StackableStage extends Stage { public void replace(Actor screen) { stack.replace(screen); } }
StackableStage extends Stage { public void replace(Actor screen) { stack.replace(screen); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); }
StackableStage extends Stage { public void replace(Actor screen) { stack.replace(screen); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); ScreenStack getScreenStack(); void replace(Actor screen); void push(Actor screen); void pop(int n); }
StackableStage extends Stage { public void replace(Actor screen) { stack.replace(screen); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); ScreenStack getScreenStack(); void replace(Actor screen); void push(Actor screen); void pop(int n); }
@Test public void pop() { stage.pop(2); verify(stack).pop(eq(2)); }
public void pop(int n) { stack.pop(n); }
StackableStage extends Stage { public void pop(int n) { stack.pop(n); } }
StackableStage extends Stage { public void pop(int n) { stack.pop(n); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); }
StackableStage extends Stage { public void pop(int n) { stack.pop(n); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); ScreenStack getScreenStack(); void replace(Actor screen); void push(Actor screen); void pop(int n); }
StackableStage extends Stage { public void pop(int n) { stack.pop(n); } StackableStage(Viewport viewport, ScreenStack stack); StackableStage(Viewport viewport); ScreenStack getScreenStack(); void replace(Actor screen); void push(Actor screen); void pop(int n); }
@Test public void notMarkedOnStart() { Receptor receptor = new Receptor(); assertThat(receptor.isMarked()).isFalse(); }
public boolean isMarked() { return marked; }
Receptor extends Tileable { public boolean isMarked() { return marked; } }
Receptor extends Tileable { public boolean isMarked() { return marked; } }
Receptor extends Tileable { public boolean isMarked() { return marked; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override boolean isReleasable(Direction dir...
Receptor extends Tileable { public boolean isMarked() { return marked; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override boolean isReleasable(Direction dir...
@Test public void acceptsWhenSlotEmpty() { Receptor receptor = new Receptor(); assertThat(receptor.accepts(Direction.LEFT, marble)).isTrue(); }
@Override public boolean accepts(Direction direction, Marble marble) { return !locked && !getSlot(direction).isOccupied(); }
Receptor extends Tileable { @Override public boolean accepts(Direction direction, Marble marble) { return !locked && !getSlot(direction).isOccupied(); } }
Receptor extends Tileable { @Override public boolean accepts(Direction direction, Marble marble) { return !locked && !getSlot(direction).isOccupied(); } }
Receptor extends Tileable { @Override public boolean accepts(Direction direction, Marble marble) { return !locked && !getSlot(direction).isOccupied(); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
Receptor extends Tileable { @Override public boolean accepts(Direction direction, Marble marble) { return !locked && !getSlot(direction).isOccupied(); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
@Test public void allowsConnectionLeft() { assertThat(receptor.allowsConnection(Direction.LEFT)).isTrue(); }
@Override public boolean allowsConnection(Direction direction) { return true; }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
@Test public void allowsConnectionRight() { assertThat(receptor.allowsConnection(Direction.RIGHT)).isTrue(); }
@Override public boolean allowsConnection(Direction direction) { return true; }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
@Test public void allowsConnectionTop() { assertThat(receptor.allowsConnection(Direction.TOP)).isTrue(); }
@Override public boolean allowsConnection(Direction direction) { return true; }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
@Test public void allowsConnectionBottom() { assertThat(receptor.allowsConnection(Direction.BOTTOM)).isTrue(); }
@Override public boolean allowsConnection(Direction direction) { return true; }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } }
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
Receptor extends Tileable { @Override public boolean allowsConnection(Direction direction) { return true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override...
@Test public void lock() { receptor.lock(); assertThat(receptor.isLocked()).isTrue(); }
public void lock() { this.locked = true; }
Receptor extends Tileable { public void lock() { this.locked = true; } }
Receptor extends Tileable { public void lock() { this.locked = true; } }
Receptor extends Tileable { public void lock() { this.locked = true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override boolean isReleasable(Direction direc...
Receptor extends Tileable { public void lock() { this.locked = true; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override boolean isReleasable(Direction direc...
@Test public void unlock() { receptor.unlock(); assertThat(receptor.isLocked()).isFalse(); }
public void unlock() { this.locked = false; }
Receptor extends Tileable { public void unlock() { this.locked = false; } }
Receptor extends Tileable { public void unlock() { this.locked = false; } }
Receptor extends Tileable { public void unlock() { this.locked = false; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override boolean isReleasable(Direction di...
Receptor extends Tileable { public void unlock() { this.locked = false; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Override boolean isReleasable(Direction di...
@Test public void propertyNotExists() throws Exception { when(api.getStringValueOf(anyString())).thenThrow(new NotExistingVariableException("")); assertThat(config.exists(new StringProperty("test", ""))).isFalse(); }
@Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); @Override @SuppressWarnings("unchecked") T get(Prop...
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); @Override @SuppressWarnings("unchecked") T get(Prop...
@Test public void unlockedReceptorIsNotReleasable() { Grid grid = new Grid(null,1, 1); grid.place(0, 0, receptor); assertThat(receptor.isReleasable(Direction.LEFT, marble)).isFalse(); }
@Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); }
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } }
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } }
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerU...
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerU...
@Test public void isReleasable() { Grid grid = new Grid(null,2, 1); grid.place(0, 0, new HorizontalTrack()); grid.place(1, 0, receptor); assertThat(receptor.isReleasable(Direction.LEFT, marble)).isTrue(); }
@Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); }
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } }
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } }
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerU...
Receptor extends Tileable { @Override public boolean isReleasable(Direction direction, Marble marble) { return !isLocked() && super.isReleasable(direction, marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerU...
@Test public void isNotCompatibleB() { Grid grid = new Grid(null, 1, 1); grid.place(0, 0, receptor); assertThat(receptor.getSlot(Direction.LEFT) .isCompatible(receptor.getSlot(Direction.RIGHT))).isFalse(); }
public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
@Test public void acceptWhenSlotOccupied() { receptor.accept(Direction.TOP, new Marble(MarbleType.BLUE)); assertThatThrownBy(() -> receptor.accept(Direction.TOP, new Marble(MarbleType.BLUE))) .isInstanceOf(IllegalStateException.class) .hasMessage("The slot is already occupied"); }
@Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); }
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } }
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } }
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(Pow...
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(Pow...
@Test public void getReceptor() { assertThat(receptor.getSlot(Direction.LEFT).getReceptor()).isEqualTo(receptor); }
public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
@Test public void releaseUnoccupiedSlot() { Receptor.Slot slot = receptor.getSlot(Direction.LEFT); assertThatThrownBy(slot::release) .isInstanceOf(IllegalStateException.class) .hasMessage("The slot is not occupied"); }
public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } }
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
Receptor extends Tileable { public Slot getSlot(Direction direction) { return slots[Math.floorMod(direction.ordinal() - rotation, directions.length)]; } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp()...
@Test public void mark() { ReceptorListener listener = mock(ReceptorListener.class); ReceptorListener stub = new ReceptorListener() {}; TileableListener tileableListener = mock(TileableListener.class); receptor.addListener(listener); receptor.addListener(stub); receptor.addListener(tileableListener); Progress progress ...
private void mark() { marked = true; getTile().getGrid().getSession().getProgress().score(multiplier); for (Slot slot : slots) { slot.dispose(); } informMarked(); if (powerUp != null) { powerUp.activate(this); setPowerUp(null); } }
Receptor extends Tileable { private void mark() { marked = true; getTile().getGrid().getSession().getProgress().score(multiplier); for (Slot slot : slots) { slot.dispose(); } informMarked(); if (powerUp != null) { powerUp.activate(this); setPowerUp(null); } } }
Receptor extends Tileable { private void mark() { marked = true; getTile().getGrid().getSession().getProgress().score(multiplier); for (Slot slot : slots) { slot.dispose(); } informMarked(); if (powerUp != null) { powerUp.activate(this); setPowerUp(null); } } }
Receptor extends Tileable { private void mark() { marked = true; getTile().getGrid().getSession().getProgress().score(multiplier); for (Slot slot : slots) { slot.dispose(); } informMarked(); if (powerUp != null) { powerUp.activate(this); setPowerUp(null); } } void rotate(int turns); int getRotation(); Slot getSlot(Dir...
Receptor extends Tileable { private void mark() { marked = true; getTile().getGrid().getSession().getProgress().score(multiplier); for (Slot slot : slots) { slot.dispose(); } informMarked(); if (powerUp != null) { powerUp.activate(this); setPowerUp(null); } } void rotate(int turns); int getRotation(); Slot getSlot(Dir...
@Test public void notMark() { ReceptorListener listener = mock(ReceptorListener.class); ReceptorListener stub = new ReceptorListener() {}; TileableListener tileableListener = mock(TileableListener.class); receptor.addListener(listener); receptor.addListener(stub); receptor.addListener(tileableListener); Progress progre...
@Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); }
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } }
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } }
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(Pow...
Receptor extends Tileable { @Override public void accept(Direction direction, Marble marble) { getSlot(direction).accept(marble); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(Pow...
@Test public void assigned() { ReceptorListener listener = mock(ReceptorListener.class); ReceptorListener stub = new ReceptorListener() {}; TileableListener tileableListener = mock(TileableListener.class); receptor.addListener(listener); receptor.addListener(stub); receptor.addListener(tileableListener); receptor.setPo...
public void setPowerUp(PowerUp powerUp) { this.powerUp = powerUp; informAssigned(); }
Receptor extends Tileable { public void setPowerUp(PowerUp powerUp) { this.powerUp = powerUp; informAssigned(); } }
Receptor extends Tileable { public void setPowerUp(PowerUp powerUp) { this.powerUp = powerUp; informAssigned(); } }
Receptor extends Tileable { public void setPowerUp(PowerUp powerUp) { this.powerUp = powerUp; informAssigned(); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Ov...
Receptor extends Tileable { public void setPowerUp(PowerUp powerUp) { this.powerUp = powerUp; informAssigned(); } void rotate(int turns); int getRotation(); Slot getSlot(Direction direction); boolean isMarked(); boolean isLocked(); void lock(); void unlock(); PowerUp getPowerUp(); void setPowerUp(PowerUp powerUp); @Ov...
@Test public void createA() { NavigableMap<Double, PowerUpFactory> cdf = new TreeMap<>(); cdf.put(0.0, new BonusPowerUpFactory()); cdf.put(0.6, new JokerPowerUpFactory()); PowerUpFactory factory = new RandomPowerUpFactory(random, cdf); when(random.nextDouble()).thenReturn(0.4); assertThat(factory.create()).isInstanceOf...
@Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } RandomPowerUpFactory(Random random, NavigableMap<Double, PowerUpFactory> cdf); }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } RandomPowerUpFactory(Random random, NavigableMap<Double, PowerUpFactory> cdf); @Override PowerUp create(); }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } RandomPowerUpFactory(Random random, NavigableMap<Double, PowerUpFactory> cdf); @Override PowerUp create(); }
@Test public void propertyNullNotExists() throws Exception { when(api.getStringValueOf(anyString())).thenReturn(null); assertThat(config.exists(new StringProperty("test", ""))).isFalse(); }
@Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); }
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); @Override @SuppressWarnings("unchecked") T get(Prop...
DefProConfiguration implements Configuration { @Override public boolean exists(Property<?> property) { try { return api.getStringValueOf(property.getKey()) != null; } catch (NotExistingVariableException ignored) { return false; } } DefProConfiguration(IDefProAPI api); @Override @SuppressWarnings("unchecked") T get(Prop...
@Test public void createB() { NavigableMap<Double, PowerUpFactory> cdf = new TreeMap<>(); cdf.put(0.0, new BonusPowerUpFactory()); cdf.put(0.6, new JokerPowerUpFactory()); PowerUpFactory factory = new RandomPowerUpFactory(random, cdf); when(random.nextDouble()).thenReturn(0.7); assertThat(factory.create()).isInstanceOf...
@Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } RandomPowerUpFactory(Random random, NavigableMap<Double, PowerUpFactory> cdf); }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } RandomPowerUpFactory(Random random, NavigableMap<Double, PowerUpFactory> cdf); @Override PowerUp create(); }
RandomPowerUpFactory extends PowerUpFactory { @Override public PowerUp create() { return cdf.floorEntry(random.nextDouble()).getValue().create(); } RandomPowerUpFactory(Random random, NavigableMap<Double, PowerUpFactory> cdf); @Override PowerUp create(); }
@Test public void activate() { receptor.setPowerUp(powerUp); for (Direction direction : Direction.values()) { receptor.accept(direction, new Marble(MarbleType.BLUE)); } assertThat(session.getProgress().getScore()).isEqualTo(200); }
@Override public void activate(Receptor receptor) { receptor.getTile().getGrid().getSession().getProgress().score(100); }
BonusPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { receptor.getTile().getGrid().getSession().getProgress().score(100); } }
BonusPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { receptor.getTile().getGrid().getSession().getProgress().score(100); } }
BonusPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { receptor.getTile().getGrid().getSession().getProgress().score(100); } @Override void activate(Receptor receptor); }
BonusPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { receptor.getTile().getGrid().getSession().getProgress().score(100); } @Override void activate(Receptor receptor); }
@Test public void activate() { receptor.setPowerUp(powerUp); for (Direction direction : Direction.values()) { receptor.accept(direction, new Marble(MarbleType.BLUE)); } verify(context).add(MarbleType.JOKER, MarbleType.JOKER); }
@Override public void activate(Receptor receptor) { NexusContext context = receptor.getTile().getGrid().getSession().getNexusContext(); context.add(MarbleType.JOKER, MarbleType.JOKER); }
JokerPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { NexusContext context = receptor.getTile().getGrid().getSession().getNexusContext(); context.add(MarbleType.JOKER, MarbleType.JOKER); } }
JokerPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { NexusContext context = receptor.getTile().getGrid().getSession().getNexusContext(); context.add(MarbleType.JOKER, MarbleType.JOKER); } }
JokerPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { NexusContext context = receptor.getTile().getGrid().getSession().getNexusContext(); context.add(MarbleType.JOKER, MarbleType.JOKER); } @Override void activate(Receptor receptor); }
JokerPowerUp implements PowerUp { @Override public void activate(Receptor receptor) { NexusContext context = receptor.getTile().getGrid().getSession().getNexusContext(); context.add(MarbleType.JOKER, MarbleType.JOKER); } @Override void activate(Receptor receptor); }
@Test public void allowsLeft() { assertThat(teleporter1.allowsConnection(Direction.LEFT)).isTrue(); }
@Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
@Test public void allowsRight() { assertThat(teleporter1.allowsConnection(Direction.RIGHT)).isTrue(); }
@Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
@Test public void disallowsTop() { assertThat(teleporter1.allowsConnection(Direction.TOP)).isFalse(); }
@Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
@Test public void disallowsBottom() { assertThat(teleporter1.allowsConnection( Direction.BOTTOM)).isFalse(); }
@Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
Teleporter extends Tileable implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(D...
@Test public void acceptsLeft() { assertThat(teleporter1.accepts(Direction.LEFT, new Marble( MarbleType.GREEN))).isTrue(); }
@Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); }
Teleporter extends Tileable implements TileableListener { @Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); } }
Teleporter extends Tileable implements TileableListener { @Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { @Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnect...
Teleporter extends Tileable implements TileableListener { @Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnect...
@Test public void getTrack() { assertThat(teleporter1.getTrack()).isEqualTo(inner); }
public Track getTrack() { return track; }
Teleporter extends Tileable implements TileableListener { public Track getTrack() { return track; } }
Teleporter extends Tileable implements TileableListener { public Track getTrack() { return track; } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { public Track getTrack() { return track; } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direction direction,...
Teleporter extends Tileable implements TileableListener { public Track getTrack() { return track; } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direction direction,...
@Test public void getDestination() { assertThat(teleporter1.getDestination()).isEqualTo(teleporter2); assertThat(teleporter2.getDestination()).isEqualTo(teleporter1); }
public Teleporter getDestination() { return destination; }
Teleporter extends Tileable implements TileableListener { public Teleporter getDestination() { return destination; } }
Teleporter extends Tileable implements TileableListener { public Teleporter getDestination() { return destination; } Teleporter(Track track); }
Teleporter extends Tileable implements TileableListener { public Teleporter getDestination() { return destination; } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Dir...
Teleporter extends Tileable implements TileableListener { public Teleporter getDestination() { return destination; } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Dir...
@Test public void getBooleanProperty() throws Exception { when(api.getBooleanValueOf("a")).thenReturn(true); assertThat(config.get(new BooleanProperty("a", false))).isTrue(); }
@Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; value = getList(listProperty); } else { value =...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ...
@Test public void checkUriIsValidTest() { String url = "http: UriUtils.checkUrlIsValid(url); url = "https: UriUtils.checkUrlIsValid(url); url = "http: UriUtils.checkUrlIsValid(url); url = "https: UriUtils.checkUrlIsValid(url); url = "http: UriUtils.checkUrlIsValid(url); url = "http: UriUtils.checkUrlIsValid(url); url =...
public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches(); }else{ ur...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
@Test(expected = ImpossibleToLoginException.class) public void loginToGalleryTestFailBecauseUrlIsWrong() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery("http: "hackerPassword"); }
public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[un...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
@Test @Ignore public void sendImageToGalleryTest() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery(galleryUrl, user, password); File imageFile = new File("image.png"); int newItemId = g2ConnectionUtils.sendImageToGallery(galleryUrl, 174, imageFile, "plouf", "Summary from test", "Description from te...
public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, summary, desc...
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, su...
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, su...
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, su...
G2Client { public int sendImageToGallery(String galleryUrl, int albumName, File imageFile, String imageName, String summary, String description) throws GalleryConnectionException { int imageCreatedName = 0; MultipartEntity multiPartEntity = createMultiPartEntityForSendImageToGallery( albumName, imageFile, imageName, su...
@Test public void createNewAlbumTest() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery(galleryUrl, user, password); Random random = new Random(); int randomInt = random.nextInt(); String albumName = "UnitTestAlbumNumber" + randomInt; String albumTitle = "Unit Test Album"; String albumDescription = ...
public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VA...
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_...
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_...
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_...
G2Client { public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle, String albumDescription) throws GalleryConnectionException { int newAlbumName = 0; List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(CREATE_ALBUM_...
@Test public void extractG2PictureFromPropertiesTest() throws GalleryConnectionException { HashMap<String, String> fetchImages = new HashMap<String, String>(); fetchImages.put("image.thumb_height.393", "150"); fetchImages.put("image.title.393", "picture.jpg"); fetchImages.put("image.resizedName.393", "12600"); fetchIma...
public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, String> entry ...
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, Str...
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, Str...
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, Str...
G2Client { public Collection<G2Picture> extractG2PicturesFromProperties( HashMap<String, String> fetchImages) throws GalleryConnectionException { Map<Integer, G2Picture> picturesMap = new HashMap<Integer, G2Picture>(); List<Integer> tmpImageNumbers = new ArrayList<Integer>(); int imageNumber = 0; for (Entry<String, Str...
@Test public void extractAlbumFromPropertiesTest() throws GalleryConnectionException { HashMap<String, String> albumsProperties = new HashMap<String, String>(); albumsProperties.put("album.name.1", "10726"); albumsProperties.put("album.title.1", "Brunch"); albumsProperties.put("album.summary.1", "Le Dimanche de 11h à 1...
public Map<Integer, G2Album> extractAlbumFromProperties( HashMap<String, String> albumsProperties) throws GalleryConnectionException { int albumNumber = 0; Map<Integer, G2Album> albumsMap = new HashMap<Integer, G2Album>(); List<Integer> tmpAlbumNumbers = new ArrayList<Integer>(); for (Entry<String, String> entry : albu...
G2Client { public Map<Integer, G2Album> extractAlbumFromProperties( HashMap<String, String> albumsProperties) throws GalleryConnectionException { int albumNumber = 0; Map<Integer, G2Album> albumsMap = new HashMap<Integer, G2Album>(); List<Integer> tmpAlbumNumbers = new ArrayList<Integer>(); for (Entry<String, String> e...
G2Client { public Map<Integer, G2Album> extractAlbumFromProperties( HashMap<String, String> albumsProperties) throws GalleryConnectionException { int albumNumber = 0; Map<Integer, G2Album> albumsMap = new HashMap<Integer, G2Album>(); List<Integer> tmpAlbumNumbers = new ArrayList<Integer>(); for (Entry<String, String> e...
G2Client { public Map<Integer, G2Album> extractAlbumFromProperties( HashMap<String, String> albumsProperties) throws GalleryConnectionException { int albumNumber = 0; Map<Integer, G2Album> albumsMap = new HashMap<Integer, G2Album>(); List<Integer> tmpAlbumNumbers = new ArrayList<Integer>(); for (Entry<String, String> e...
G2Client { public Map<Integer, G2Album> extractAlbumFromProperties( HashMap<String, String> albumsProperties) throws GalleryConnectionException { int albumNumber = 0; Map<Integer, G2Album> albumsMap = new HashMap<Integer, G2Album>(); List<Integer> tmpAlbumNumbers = new ArrayList<Integer>(); for (Entry<String, String> e...
@Test public void organizeAlbumsHierarchy() throws Exception { Map<Integer, G2Album> albums = new HashMap<Integer, G2Album>(); G2Album album = new G2Album(); album.setName(6); album.setId(600); album.setParentName(20); albums.put(album.getId(), album); album = new G2Album(); album.setName(3); album.setId(300); album.se...
public Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums) { Album rootAlbum = null; Map<Integer, Album> albumss = new HashMap<Integer, Album>(); for (Integer key : albums.keySet()) { albumss.put(key, G2ConvertUtils.g2AlbumToAlbum(albums.get(key))); } for (Album album : albumss.values()) { if (album.getParentNa...
G2Client { public Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums) { Album rootAlbum = null; Map<Integer, Album> albumss = new HashMap<Integer, Album>(); for (Integer key : albums.keySet()) { albumss.put(key, G2ConvertUtils.g2AlbumToAlbum(albums.get(key))); } for (Album album : albumss.values()) { if (album....
G2Client { public Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums) { Album rootAlbum = null; Map<Integer, Album> albumss = new HashMap<Integer, Album>(); for (Integer key : albums.keySet()) { albumss.put(key, G2ConvertUtils.g2AlbumToAlbum(albums.get(key))); } for (Album album : albumss.values()) { if (album....
G2Client { public Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums) { Album rootAlbum = null; Map<Integer, Album> albumss = new HashMap<Integer, Album>(); for (Integer key : albums.keySet()) { albumss.put(key, G2ConvertUtils.g2AlbumToAlbum(albums.get(key))); } for (Album album : albumss.values()) { if (album....
G2Client { public Album organizeAlbumsHierarchy(Map<Integer, G2Album> albums) { Album rootAlbum = null; Map<Integer, Album> albumss = new HashMap<Integer, Album>(); for (Integer key : albums.keySet()) { albumss.put(key, G2ConvertUtils.g2AlbumToAlbum(albums.get(key))); } for (Album album : albumss.values()) { if (album....
@Test public void g2AlbumToAlbum() throws IOException, JSONException { G2Album g2Album = new G2Album(); g2Album.setId(1024); g2Album.setTitle("Title"); g2Album.setName(12); g2Album.setSummary("Summary"); g2Album.setParentName(1); g2Album.setExtrafields("extrafields"); Album album = G2ConvertUtils.g2AlbumToAlbum(g2Album...
public static Album g2AlbumToAlbum(G2Album g2Album) { if(g2Album==null){ return null; } Album album = new Album(); album.setId(g2Album.getId()); album.setName(g2Album.getName()); album.setTitle(g2Album.getTitle()); album.setSummary(g2Album.getSummary()); album.setParentName(g2Album.getParentName()); return album; }
G2ConvertUtils { public static Album g2AlbumToAlbum(G2Album g2Album) { if(g2Album==null){ return null; } Album album = new Album(); album.setId(g2Album.getId()); album.setName(g2Album.getName()); album.setTitle(g2Album.getTitle()); album.setSummary(g2Album.getSummary()); album.setParentName(g2Album.getParentName()); re...
G2ConvertUtils { public static Album g2AlbumToAlbum(G2Album g2Album) { if(g2Album==null){ return null; } Album album = new Album(); album.setId(g2Album.getId()); album.setName(g2Album.getName()); album.setTitle(g2Album.getTitle()); album.setSummary(g2Album.getSummary()); album.setParentName(g2Album.getParentName()); re...
G2ConvertUtils { public static Album g2AlbumToAlbum(G2Album g2Album) { if(g2Album==null){ return null; } Album album = new Album(); album.setId(g2Album.getId()); album.setName(g2Album.getName()); album.setTitle(g2Album.getTitle()); album.setSummary(g2Album.getSummary()); album.setParentName(g2Album.getParentName()); re...
G2ConvertUtils { public static Album g2AlbumToAlbum(G2Album g2Album) { if(g2Album==null){ return null; } Album album = new Album(); album.setId(g2Album.getId()); album.setName(g2Album.getName()); album.setTitle(g2Album.getTitle()); album.setSummary(g2Album.getSummary()); album.setParentName(g2Album.getParentName()); re...
@Test public void g2PictureToPicture() throws IOException, JSONException { G2Picture g2Picture = new G2Picture(); g2Picture.setTitle("Title.jpg"); g2Picture.setId(10214); g2Picture.setName("1"); g2Picture.setThumbName("2"); g2Picture.setThumbWidth(320); g2Picture.setThumbHeight(480); g2Picture.setResizedName("3"); g2Pi...
public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.getTitle()); picture...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
@Test public void g2PictureToPicture__noresize() throws IOException, JSONException { G2Picture g2Picture = new G2Picture(); g2Picture.setTitle("Title.jpg"); g2Picture.setId(10214); g2Picture.setName("1"); g2Picture.setThumbName("2"); g2Picture.setThumbWidth(320); g2Picture.setThumbHeight(480); g2Picture.setResizedName(...
public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.getTitle()); picture...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
G2ConvertUtils { public static Picture g2PictureToPicture(G2Picture g2Picture, String galleryUrl) { if(g2Picture==null ){ return null; } String baseUrl = getBaseUrl(galleryUrl); Picture picture = new Picture(); picture.setId(g2Picture.getId()); picture.setTitle(g2Picture.getCaption()); picture.setFileName(g2Picture.get...
@Test public void jiwigoCategoryToAlbum() { Category jiwigoCategory = new Category(); jiwigoCategory.setIdentifier(43); jiwigoCategory.setName("MyAlbum"); jiwigoCategory.setDirectParent(1); Album album = JiwigoConvertUtils.jiwigoCategoryToAlbum(jiwigoCategory); Album expectedAlbum = new Album(); expectedAlbum.setId(43)...
public static Album jiwigoCategoryToAlbum(Category jiwigoCategory) { if(jiwigoCategory==null){ return null; } Album album = new Album(); album.setId(jiwigoCategory.getIdentifier()); album.setName(jiwigoCategory.getIdentifier()); album.setTitle(jiwigoCategory.getName()); album.setParentName(jiwigoCategory.getDirectParen...
JiwigoConvertUtils { public static Album jiwigoCategoryToAlbum(Category jiwigoCategory) { if(jiwigoCategory==null){ return null; } Album album = new Album(); album.setId(jiwigoCategory.getIdentifier()); album.setName(jiwigoCategory.getIdentifier()); album.setTitle(jiwigoCategory.getName()); album.setParentName(jiwigoCa...
JiwigoConvertUtils { public static Album jiwigoCategoryToAlbum(Category jiwigoCategory) { if(jiwigoCategory==null){ return null; } Album album = new Album(); album.setId(jiwigoCategory.getIdentifier()); album.setName(jiwigoCategory.getIdentifier()); album.setTitle(jiwigoCategory.getName()); album.setParentName(jiwigoCa...
JiwigoConvertUtils { public static Album jiwigoCategoryToAlbum(Category jiwigoCategory) { if(jiwigoCategory==null){ return null; } Album album = new Album(); album.setId(jiwigoCategory.getIdentifier()); album.setName(jiwigoCategory.getIdentifier()); album.setTitle(jiwigoCategory.getName()); album.setParentName(jiwigoCa...
JiwigoConvertUtils { public static Album jiwigoCategoryToAlbum(Category jiwigoCategory) { if(jiwigoCategory==null){ return null; } Album album = new Album(); album.setId(jiwigoCategory.getIdentifier()); album.setName(jiwigoCategory.getIdentifier()); album.setTitle(jiwigoCategory.getName()); album.setParentName(jiwigoCa...
@Test(expected=IllegalArgumentException.class) public void spaceIsNotValidTest(){ String url = "http: UriUtils.checkUrlIsValid(url); }
public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches(); }else{ ur...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
@Test public void jiwigoImageToPicture() { Image jiwigoImage = new Image(); jiwigoImage.setName("Title"); jiwigoImage.setFile("Title.jpg"); jiwigoImage.setIdentifier(10214); jiwigoImage .setThumbnailUrl("http: jiwigoImage.setWidth(768); jiwigoImage.setHeight(1024); jiwigoImage .setUrl("http: Picture picture = JiwigoCon...
public static Picture jiwigoImageToPicture(Image jiwigoImage) { if(jiwigoImage==null ){ return null; } Picture picture = new Picture(); picture.setId(jiwigoImage.getIdentifier()); picture.setTitle(jiwigoImage.getName()); picture.setFileName(jiwigoImage.getFile()); picture.setThumbUrl(jiwigoImage.getThumbnailUrl()); pic...
JiwigoConvertUtils { public static Picture jiwigoImageToPicture(Image jiwigoImage) { if(jiwigoImage==null ){ return null; } Picture picture = new Picture(); picture.setId(jiwigoImage.getIdentifier()); picture.setTitle(jiwigoImage.getName()); picture.setFileName(jiwigoImage.getFile()); picture.setThumbUrl(jiwigoImage.ge...
JiwigoConvertUtils { public static Picture jiwigoImageToPicture(Image jiwigoImage) { if(jiwigoImage==null ){ return null; } Picture picture = new Picture(); picture.setId(jiwigoImage.getIdentifier()); picture.setTitle(jiwigoImage.getName()); picture.setFileName(jiwigoImage.getFile()); picture.setThumbUrl(jiwigoImage.ge...
JiwigoConvertUtils { public static Picture jiwigoImageToPicture(Image jiwigoImage) { if(jiwigoImage==null ){ return null; } Picture picture = new Picture(); picture.setId(jiwigoImage.getIdentifier()); picture.setTitle(jiwigoImage.getName()); picture.setFileName(jiwigoImage.getFile()); picture.setThumbUrl(jiwigoImage.ge...
JiwigoConvertUtils { public static Picture jiwigoImageToPicture(Image jiwigoImage) { if(jiwigoImage==null ){ return null; } Picture picture = new Picture(); picture.setId(jiwigoImage.getIdentifier()); picture.setTitle(jiwigoImage.getName()); picture.setFileName(jiwigoImage.getFile()); picture.setThumbUrl(jiwigoImage.ge...
@Test public void categoriesToAlbum() { List<Category> categories = new ArrayList<Category>(); Category coaticook = new Category(); coaticook.setName("coaticook"); coaticook.setIdentifier(1); Category barrage = new Category(); barrage.setName("barrage"); barrage.setIdentifier(2); Category barrage2 = new Category(); bar...
public static Album categoriesToAlbum(List<Category> categories){ Album resultAlbum = new Album(); resultAlbum.setName(0); resultAlbum.setId(0); Album album; for (Category category : categories) { album = jiwigoCategoryToAlbum(category); if(category.getParentCategories().size()==0){ resultAlbum.getSubAlbums().add(album...
JiwigoConvertUtils { public static Album categoriesToAlbum(List<Category> categories){ Album resultAlbum = new Album(); resultAlbum.setName(0); resultAlbum.setId(0); Album album; for (Category category : categories) { album = jiwigoCategoryToAlbum(category); if(category.getParentCategories().size()==0){ resultAlbum.get...
JiwigoConvertUtils { public static Album categoriesToAlbum(List<Category> categories){ Album resultAlbum = new Album(); resultAlbum.setName(0); resultAlbum.setId(0); Album album; for (Category category : categories) { album = jiwigoCategoryToAlbum(category); if(category.getParentCategories().size()==0){ resultAlbum.get...
JiwigoConvertUtils { public static Album categoriesToAlbum(List<Category> categories){ Album resultAlbum = new Album(); resultAlbum.setName(0); resultAlbum.setId(0); Album album; for (Category category : categories) { album = jiwigoCategoryToAlbum(category); if(category.getParentCategories().size()==0){ resultAlbum.get...
JiwigoConvertUtils { public static Album categoriesToAlbum(List<Category> categories){ Album resultAlbum = new Album(); resultAlbum.setName(0); resultAlbum.setId(0); Album album; for (Category category : categories) { album = jiwigoCategoryToAlbum(category); if(category.getParentCategories().size()==0){ resultAlbum.get...
@Test public void getItemTest__album() throws G3GalleryException { Item item1 = itemClient.getItem(1); assertEquals("Gallery", item1.getEntity().getTitle()); }
public Item getItem(int itemId) throws G3GalleryException { Item item = null; String stringResult = sendHttpRequest(INDEX_PHP_REST_ITEM + itemId, new ArrayList<NameValuePair>(), GET, null); try { JSONObject jsonResult = (JSONObject) new JSONTokener(stringResult) .nextValue(); item = ItemUtils.parseJSONToItem(jsonResult...
G3Client implements IG3Client { public Item getItem(int itemId) throws G3GalleryException { Item item = null; String stringResult = sendHttpRequest(INDEX_PHP_REST_ITEM + itemId, new ArrayList<NameValuePair>(), GET, null); try { JSONObject jsonResult = (JSONObject) new JSONTokener(stringResult) .nextValue(); item = Item...
G3Client implements IG3Client { public Item getItem(int itemId) throws G3GalleryException { Item item = null; String stringResult = sendHttpRequest(INDEX_PHP_REST_ITEM + itemId, new ArrayList<NameValuePair>(), GET, null); try { JSONObject jsonResult = (JSONObject) new JSONTokener(stringResult) .nextValue(); item = Item...
G3Client implements IG3Client { public Item getItem(int itemId) throws G3GalleryException { Item item = null; String stringResult = sendHttpRequest(INDEX_PHP_REST_ITEM + itemId, new ArrayList<NameValuePair>(), GET, null); try { JSONObject jsonResult = (JSONObject) new JSONTokener(stringResult) .nextValue(); item = Item...
G3Client implements IG3Client { public Item getItem(int itemId) throws G3GalleryException { Item item = null; String stringResult = sendHttpRequest(INDEX_PHP_REST_ITEM + itemId, new ArrayList<NameValuePair>(), GET, null); try { JSONObject jsonResult = (JSONObject) new JSONTokener(stringResult) .nextValue(); item = Item...
@Test public void getApiKey() throws G3GalleryException { String apiKey = itemClient.getApiKey(); assertNotNull(apiKey); }
public String getApiKey() throws G3GalleryException { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("user", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); String jsonResult = sendHttpRequest(INDEX_PHP_REST, nameValuePairs, P...
G3Client implements IG3Client { public String getApiKey() throws G3GalleryException { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("user", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); String jsonResult = sendHttpRequest(I...
G3Client implements IG3Client { public String getApiKey() throws G3GalleryException { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("user", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); String jsonResult = sendHttpRequest(I...
G3Client implements IG3Client { public String getApiKey() throws G3GalleryException { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("user", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); String jsonResult = sendHttpRequest(I...
G3Client implements IG3Client { public String getApiKey() throws G3GalleryException { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("user", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); String jsonResult = sendHttpRequest(I...
@Test public void createAlbum() throws G3GalleryException { Entity albumToCreate = new Entity(); albumToCreate.setName("AlbumName" + System.currentTimeMillis()); albumToCreate.setTitle("New Album"); albumToCreate.setParent(G2ANDROID_SECRET_ALBUM); createdAlbumId = itemClient.createItem(albumToCreate, null); assertNotNu...
public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertPh...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
@Ignore @Test(expected = G3BadRequestException.class) public void createAlbum__already_exists() throws G3GalleryException { long albumSuffix = System.currentTimeMillis(); Entity albumToCreate = new Entity(); albumToCreate.setName("AlbumName" + albumSuffix); albumToCreate.setTitle("New Album"); albumToCreate.setParent(G...
public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertPh...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePa...
@Test public void getAlbumAndSubAlbumsTest() throws G3GalleryException { List<Item> subAlbums = itemClient.getAlbumAndSubAlbums(11); boolean foundRecentlyAddedAlbum = false; for (Item album : subAlbums) { if (album.getEntity().getId() == createdAlbumId) { foundRecentlyAddedAlbum = true; } } assertTrue(foundRecentlyAdde...
public List<Item> getAlbumAndSubAlbums(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); Item item = getItems(albumId, items, "album"); items.add(0, item); return items; }
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbums(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); Item item = getItems(albumId, items, "album"); items.add(0, item); return items; } }
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbums(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); Item item = getItems(albumId, items, "album"); items.add(0, item); return items; } G3Client(String galleryUrl, String userAgent); }
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbums(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); Item item = getItems(albumId, items, "album"); items.add(0, item); return items; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int create...
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbums(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); Item item = getItems(albumId, items, "album"); items.add(0, item); return items; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int create...
@Test public void getAlbumAndSubAlbumsAndPicturesTest() throws G3GalleryException { List<Item> albumAndSubAlbumsAndPictures = itemClient.getAlbumAndSubAlbumsAndPictures(172); Map<Integer,String> actual = new HashMap<Integer, String>(); for (Item album : albumAndSubAlbumsAndPictures) { actual.put(album.getEntity().getId...
public List<Item> getAlbumAndSubAlbumsAndPictures(int albumId) throws G3GalleryException { List<Item> items = getTree(albumId, "photo,album"); return items; }
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbumsAndPictures(int albumId) throws G3GalleryException { List<Item> items = getTree(albumId, "photo,album"); return items; } }
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbumsAndPictures(int albumId) throws G3GalleryException { List<Item> items = getTree(albumId, "photo,album"); return items; } G3Client(String galleryUrl, String userAgent); }
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbumsAndPictures(int albumId) throws G3GalleryException { List<Item> items = getTree(albumId, "photo,album"); return items; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int createItem(Entity entity, File file); void updateIte...
G3Client implements IG3Client { public List<Item> getAlbumAndSubAlbumsAndPictures(int albumId) throws G3GalleryException { List<Item> items = getTree(albumId, "photo,album"); return items; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int createItem(Entity entity, File file); void updateIte...
@Test public void getPicturesTest() throws G3GalleryException { List<Item> pictures = itemClient.getPictures(11); pictures = itemClient.getPictures(172); for (Item picture : pictures) { if (!picture.getEntity().getType().equals("photo")) { fail("found some other types than photo"); } if (picture.getEntity().getResizeHe...
public List<Item> getPictures(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); getItems(albumId, items, "photo"); return items; }
G3Client implements IG3Client { public List<Item> getPictures(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); getItems(albumId, items, "photo"); return items; } }
G3Client implements IG3Client { public List<Item> getPictures(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); getItems(albumId, items, "photo"); return items; } G3Client(String galleryUrl, String userAgent); }
G3Client implements IG3Client { public List<Item> getPictures(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); getItems(albumId, items, "photo"); return items; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int createItem(Entity entity, File file); void upda...
G3Client implements IG3Client { public List<Item> getPictures(int albumId) throws G3GalleryException { List<Item> items = new ArrayList<Item>(); getItems(albumId, items, "photo"); return items; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int createItem(Entity entity, File file); void upda...
@Test public void getPhotoInputStream() throws IOException, G3GalleryException, MagicParseException, MagicMatchNotFoundException, MagicException { try { itemClient.getItem(createdPhotoId); }catch(G3ItemNotFoundException ex){ addPhoto(); } Item item1 = itemClient.getItem(createdPhotoId); String url = item1.getEntity().g...
public InputStream getPhotoInputStream(String url) throws G3GalleryException { InputStream content = null; String appendToGalleryUrl = url.substring(url.indexOf(galleryItemUrl)+galleryItemUrl.length()); try { content = requestToResponseEntity(appendToGalleryUrl, null, GET, null).getContent(); } catch (IllegalStateExcep...
G3Client implements IG3Client { public InputStream getPhotoInputStream(String url) throws G3GalleryException { InputStream content = null; String appendToGalleryUrl = url.substring(url.indexOf(galleryItemUrl)+galleryItemUrl.length()); try { content = requestToResponseEntity(appendToGalleryUrl, null, GET, null).getConte...
G3Client implements IG3Client { public InputStream getPhotoInputStream(String url) throws G3GalleryException { InputStream content = null; String appendToGalleryUrl = url.substring(url.indexOf(galleryItemUrl)+galleryItemUrl.length()); try { content = requestToResponseEntity(appendToGalleryUrl, null, GET, null).getConte...
G3Client implements IG3Client { public InputStream getPhotoInputStream(String url) throws G3GalleryException { InputStream content = null; String appendToGalleryUrl = url.substring(url.indexOf(galleryItemUrl)+galleryItemUrl.length()); try { content = requestToResponseEntity(appendToGalleryUrl, null, GET, null).getConte...
G3Client implements IG3Client { public InputStream getPhotoInputStream(String url) throws G3GalleryException { InputStream content = null; String appendToGalleryUrl = url.substring(url.indexOf(galleryItemUrl)+galleryItemUrl.length()); try { content = requestToResponseEntity(appendToGalleryUrl, null, GET, null).getConte...
@Test(expected=IllegalArgumentException.class) public void noHttpIsNotValidTest(){ String url = "badurl.net"; UriUtils.checkUrlIsValid(url); }
public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches(); }else{ ur...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
@Test public void itemToAlbum() throws IOException, JSONException { URL resource = Resources.getResource("get-album-1.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item albumItem = ItemUtils.parseJSONToItem(jsonResult); A...
public static Album itemToAlbum(Item item) { if(item==null ||item.getEntity()==null){ return null; } Album album = new Album(); album.setId(item.getEntity().getId()); album.setName(item.getEntity().getId()); album.setTitle(item.getEntity().getTitle()); album.setSummary(item.getEntity().getDescription()); album.setAlbum...
G3ConvertUtils { public static Album itemToAlbum(Item item) { if(item==null ||item.getEntity()==null){ return null; } Album album = new Album(); album.setId(item.getEntity().getId()); album.setName(item.getEntity().getId()); album.setTitle(item.getEntity().getTitle()); album.setSummary(item.getEntity().getDescription()...
G3ConvertUtils { public static Album itemToAlbum(Item item) { if(item==null ||item.getEntity()==null){ return null; } Album album = new Album(); album.setId(item.getEntity().getId()); album.setName(item.getEntity().getId()); album.setTitle(item.getEntity().getTitle()); album.setSummary(item.getEntity().getDescription()...
G3ConvertUtils { public static Album itemToAlbum(Item item) { if(item==null ||item.getEntity()==null){ return null; } Album album = new Album(); album.setId(item.getEntity().getId()); album.setName(item.getEntity().getId()); album.setTitle(item.getEntity().getTitle()); album.setSummary(item.getEntity().getDescription()...
G3ConvertUtils { public static Album itemToAlbum(Item item) { if(item==null ||item.getEntity()==null){ return null; } Album album = new Album(); album.setId(item.getEntity().getId()); album.setName(item.getEntity().getId()); album.setTitle(item.getEntity().getTitle()); album.setSummary(item.getEntity().getDescription()...
@Test public void itemToPicture() throws IOException, JSONException { URL resource = Resources.getResource("get-photo-2.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item pictureItem = ItemUtils.parseJSONToItem(jsonResult...
public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumb...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
@Test public void itemToPicture__bug3_resize_size_false() throws IOException, JSONException { URL resource = Resources.getResource("get-photo-bug3_resize_size_false.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item pictu...
public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumb...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.get...
@Test public void parseJSONToMultipleItems() throws IOException, JSONException { URL resource = Resources.getResource("tree-album-1.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); List<Item> items = ItemUtils.parseJSONToMul...
public static List<Item> parseJSONToMultipleItems(JSONObject jsonResult) throws JSONException{ JSONArray entityArrayJSON = jsonResult.getJSONArray("entity"); List<Item> list = new ArrayList<Item>(); for (int i = 0; i < entityArrayJSON.length(); i++) { Item item = new Item(); item.setUrl(((JSONObject) entityArrayJSON.ge...
ItemUtils { public static List<Item> parseJSONToMultipleItems(JSONObject jsonResult) throws JSONException{ JSONArray entityArrayJSON = jsonResult.getJSONArray("entity"); List<Item> list = new ArrayList<Item>(); for (int i = 0; i < entityArrayJSON.length(); i++) { Item item = new Item(); item.setUrl(((JSONObject) entity...
ItemUtils { public static List<Item> parseJSONToMultipleItems(JSONObject jsonResult) throws JSONException{ JSONArray entityArrayJSON = jsonResult.getJSONArray("entity"); List<Item> list = new ArrayList<Item>(); for (int i = 0; i < entityArrayJSON.length(); i++) { Item item = new Item(); item.setUrl(((JSONObject) entity...
ItemUtils { public static List<Item> parseJSONToMultipleItems(JSONObject jsonResult) throws JSONException{ JSONArray entityArrayJSON = jsonResult.getJSONArray("entity"); List<Item> list = new ArrayList<Item>(); for (int i = 0; i < entityArrayJSON.length(); i++) { Item item = new Item(); item.setUrl(((JSONObject) entity...
ItemUtils { public static List<Item> parseJSONToMultipleItems(JSONObject jsonResult) throws JSONException{ JSONArray entityArrayJSON = jsonResult.getJSONArray("entity"); List<Item> list = new ArrayList<Item>(); for (int i = 0; i < entityArrayJSON.length(); i++) { Item item = new Item(); item.setUrl(((JSONObject) entity...
@Test public void parseJSONTest__album() throws IOException, JSONException { URL resource = Resources.getResource("get-album-1.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item item = ItemUtils.parseJSONToItem(jsonResult...
public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResult)); if (it...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
@Test public void convertAlbumEntityToJSON() throws JSONException{ Entity albumEntity = new Entity(); albumEntity.setTitle("This is my Sample Album"); albumEntity.setName("Sample Album"); String convertEntityToJSON = ItemUtils.convertAlbumEntityToJSON(albumEntity); assertTrue("invalid JSON", new JSONObject(convertEntit...
public static String convertAlbumEntityToJSON(Entity entity) throws JSONException { JSONObject entityJSON = new JSONObject(); entityJSON.put("title", entity.getTitle()); entityJSON.put("type", "album"); entityJSON.put("name", entity.getName()); return entityJSON.toString(); }
ItemUtils { public static String convertAlbumEntityToJSON(Entity entity) throws JSONException { JSONObject entityJSON = new JSONObject(); entityJSON.put("title", entity.getTitle()); entityJSON.put("type", "album"); entityJSON.put("name", entity.getName()); return entityJSON.toString(); } }
ItemUtils { public static String convertAlbumEntityToJSON(Entity entity) throws JSONException { JSONObject entityJSON = new JSONObject(); entityJSON.put("title", entity.getTitle()); entityJSON.put("type", "album"); entityJSON.put("name", entity.getName()); return entityJSON.toString(); } }
ItemUtils { public static String convertAlbumEntityToJSON(Entity entity) throws JSONException { JSONObject entityJSON = new JSONObject(); entityJSON.put("title", entity.getTitle()); entityJSON.put("type", "album"); entityJSON.put("name", entity.getName()); return entityJSON.toString(); } static Item parseJSONToItem(JS...
ItemUtils { public static String convertAlbumEntityToJSON(Entity entity) throws JSONException { JSONObject entityJSON = new JSONObject(); entityJSON.put("title", entity.getTitle()); entityJSON.put("type", "album"); entityJSON.put("name", entity.getName()); return entityJSON.toString(); } static Item parseJSONToItem(JS...
@Test public void convertItemToNameValuePair(){ Item item = new Item(); Entity albumEntity = new Entity(); albumEntity.setTitle("New Album"); albumEntity.setName("AlbumName"); item.setEntity(albumEntity ); String value = "{\"title\":\"This is my Sample Album\",\"name\":\"Sample Album\",\"type\":\"album\"}"; BasicNameVa...
public static NameValuePair convertJSONStringToNameValuePair(String value) { NameValuePair nameValuePair = new BasicNameValuePair("entity", value); return nameValuePair; }
ItemUtils { public static NameValuePair convertJSONStringToNameValuePair(String value) { NameValuePair nameValuePair = new BasicNameValuePair("entity", value); return nameValuePair; } }
ItemUtils { public static NameValuePair convertJSONStringToNameValuePair(String value) { NameValuePair nameValuePair = new BasicNameValuePair("entity", value); return nameValuePair; } }
ItemUtils { public static NameValuePair convertJSONStringToNameValuePair(String value) { NameValuePair nameValuePair = new BasicNameValuePair("entity", value); return nameValuePair; } static Item parseJSONToItem(JSONObject jsonResult); static List<Item> parseJSONToMultipleItems(JSONObject jsonResult); static String co...
ItemUtils { public static NameValuePair convertJSONStringToNameValuePair(String value) { NameValuePair nameValuePair = new BasicNameValuePair("entity", value); return nameValuePair; } static Item parseJSONToItem(JSONObject jsonResult); static List<Item> parseJSONToMultipleItems(JSONObject jsonResult); static String co...
@Test public void convertJsonStringToApiKey() { String expectedKey = "e3450cdda082e6a2bddf5114a2bcc14d"; String jsonResult="\"e3450cdda082e6a2bddf5114a2bcc14d\n\""; String key = ItemUtils.convertJsonResultToApiKey(jsonResult); assertEquals(expectedKey, key); }
public static String convertJsonResultToApiKey(String jsonResult) { String apiKey; apiKey = jsonResult.replaceAll("\"", "").replaceAll("\n", ""); return apiKey; }
ItemUtils { public static String convertJsonResultToApiKey(String jsonResult) { String apiKey; apiKey = jsonResult.replaceAll("\"", "").replaceAll("\n", ""); return apiKey; } }
ItemUtils { public static String convertJsonResultToApiKey(String jsonResult) { String apiKey; apiKey = jsonResult.replaceAll("\"", "").replaceAll("\n", ""); return apiKey; } }
ItemUtils { public static String convertJsonResultToApiKey(String jsonResult) { String apiKey; apiKey = jsonResult.replaceAll("\"", "").replaceAll("\n", ""); return apiKey; } static Item parseJSONToItem(JSONObject jsonResult); static List<Item> parseJSONToMultipleItems(JSONObject jsonResult); static String convertAlbu...
ItemUtils { public static String convertJsonResultToApiKey(String jsonResult) { String apiKey; apiKey = jsonResult.replaceAll("\"", "").replaceAll("\n", ""); return apiKey; } static Item parseJSONToItem(JSONObject jsonResult); static List<Item> parseJSONToMultipleItems(JSONObject jsonResult); static String convertAlbu...
@Test public void convertJsonStringToUrl() throws JSONException{ String jsonResult="{\"url\":\"http:\\/\\/g3.dahanne.net\\/index.php\\/rest\\/item\\/34\"}"; String expectedString = "http: String urlString = ItemUtils.convertJsonStringToUrl(jsonResult); assertEquals(expectedString, urlString); }
public static String convertJsonStringToUrl(String jsonResult) throws JSONException { JSONObject jsonObject = new JSONObject(jsonResult); return (String) jsonObject.get("url"); }
ItemUtils { public static String convertJsonStringToUrl(String jsonResult) throws JSONException { JSONObject jsonObject = new JSONObject(jsonResult); return (String) jsonObject.get("url"); } }
ItemUtils { public static String convertJsonStringToUrl(String jsonResult) throws JSONException { JSONObject jsonObject = new JSONObject(jsonResult); return (String) jsonObject.get("url"); } }
ItemUtils { public static String convertJsonStringToUrl(String jsonResult) throws JSONException { JSONObject jsonObject = new JSONObject(jsonResult); return (String) jsonObject.get("url"); } static Item parseJSONToItem(JSONObject jsonResult); static List<Item> parseJSONToMultipleItems(JSONObject jsonResult); static St...
ItemUtils { public static String convertJsonStringToUrl(String jsonResult) throws JSONException { JSONObject jsonObject = new JSONObject(jsonResult); return (String) jsonObject.get("url"); } static Item parseJSONToItem(JSONObject jsonResult); static List<Item> parseJSONToMultipleItems(JSONObject jsonResult); static St...
@Test public void parseJSONTest_issue32() throws IOException, JSONException{ URL resource = Resources.getResource("get-album-bug32_owner-id-null.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item item = ItemUtils.parseJSO...
public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResult)); if (it...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
@Test(expected=IllegalArgumentException.class) public void plainStringIsNotValidTest(){ String url = "toto"; UriUtils.checkUrlIsValid(url); }
public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches(); }else{ ur...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
UriUtils { public static void checkUrlIsValid(String url) throws IllegalArgumentException { logger.debug("Url is : {}",url); boolean urlIsValid; Pattern p = Pattern.compile(URL_PATTERN); Matcher m = p.matcher(url); if (!m.matches()) { p = Pattern.compile(IP_ADDRESS_PATTERN); m = p.matcher(url); urlIsValid = m.matches()...
@Test public void parseJSONTest_issue38() throws IOException, JSONException{ URL resource = Resources.getResource("get-albums-no-relationships-38.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item item = ItemUtils.parseJS...
public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResult)); if (it...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
@Test public void parseJSONTest_issue83() throws IOException, JSONException{ URL resource = Resources.getResource("get-albums-no-comments-issue82.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item item = ItemUtils.parseJS...
public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResult)); if (it...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
ItemUtils { public static Item parseJSONToItem(JSONObject jsonResult) throws JSONException { logger.debug("parseJSONToItem jsonResult: {}",jsonResult); Item item = new Item(); item.setUrl(jsonResult.getString("url")); item.setEntity(parseJSONToEntity(jsonResult)); item.setRelationships(parseJSONToRelationShips(jsonResu...
@Test public void findAlbumFromAlbumNameTest() { Album rootAlbum = new Album(); rootAlbum.setName(999); Album album1 = new Album(); album1.setName(1); rootAlbum.getSubAlbums().add(album1); Album album2 = new Album(); album2.setName(2); rootAlbum.getSubAlbums().add(album2); Album album3 = new Album(); album3.setName(3);...
public static Album findAlbumFromAlbumName(Album rootAlbum, int albumName) { logger.debug("rootAlbum is : {} -- albumName is : {}",rootAlbum,albumName); Album albumFound=null; if (rootAlbum.getName() == albumName&& !rootAlbum.isFakeAlbum()) { albumFound= rootAlbum; } for (Album album : rootAlbum.getSubAlbums()) { if (a...
AlbumUtils { public static Album findAlbumFromAlbumName(Album rootAlbum, int albumName) { logger.debug("rootAlbum is : {} -- albumName is : {}",rootAlbum,albumName); Album albumFound=null; if (rootAlbum.getName() == albumName&& !rootAlbum.isFakeAlbum()) { albumFound= rootAlbum; } for (Album album : rootAlbum.getSubAlbu...
AlbumUtils { public static Album findAlbumFromAlbumName(Album rootAlbum, int albumName) { logger.debug("rootAlbum is : {} -- albumName is : {}",rootAlbum,albumName); Album albumFound=null; if (rootAlbum.getName() == albumName&& !rootAlbum.isFakeAlbum()) { albumFound= rootAlbum; } for (Album album : rootAlbum.getSubAlbu...
AlbumUtils { public static Album findAlbumFromAlbumName(Album rootAlbum, int albumName) { logger.debug("rootAlbum is : {} -- albumName is : {}",rootAlbum,albumName); Album albumFound=null; if (rootAlbum.getName() == albumName&& !rootAlbum.isFakeAlbum()) { albumFound= rootAlbum; } for (Album album : rootAlbum.getSubAlbu...
AlbumUtils { public static Album findAlbumFromAlbumName(Album rootAlbum, int albumName) { logger.debug("rootAlbum is : {} -- albumName is : {}",rootAlbum,albumName); Album albumFound=null; if (rootAlbum.getName() == albumName&& !rootAlbum.isFakeAlbum()) { albumFound= rootAlbum; } for (Album album : rootAlbum.getSubAlbu...
@Test public void fetchImagesTest() throws GalleryConnectionException { HashMap<String, String> fetchImages = g2ConnectionUtils.fetchImages( galleryUrl, 11); assertTrue("no pictures found",fetchImages.size() != 0); assertTrue("the string image_count could not be found",fetchImages.containsKey("image_count")); assertFal...
public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
@Test(expected = GalleryConnectionException.class) public void fetchImagesTest__exception() throws GalleryConnectionException { g2ConnectionUtils.fetchImages("http: 11); }
public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameValuePair( "...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
G2Client { public HashMap<String, String> fetchImages(String galleryUrl, int albumName) throws GalleryConnectionException { List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>(); nameValuePairsFetchImages.add(FETCH_ALBUMS_IMAGES_CMD_NAME_VALUE_PAIR); nameValuePairsFetchImages.add(new BasicNameV...
@Test public void loginToGalleryTest() throws GalleryConnectionException { g2ConnectionUtils .loginToGallery(galleryUrl, user, password); HashMap<String, String> fetchAlbums = g2ConnectionUtils .fetchAlbums(galleryUrl); boolean found = false; for (Entry<String, String> entry : fetchAlbums.entrySet()) { if (entry.getVal...
public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[un...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
@Test(expected=ImpossibleToLoginException.class) public void loginToGalleryTest__badPassword() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery(galleryUrl, "hacker", "hackerPassword"); }
public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[un...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
@Test(expected=ImpossibleToLoginException.class) public void loginToGalleryTest__galleryDoesNotAnswerWithProperties__issue24() throws GalleryConnectionException { g2ConnectionUtils.loginToGallery("http: "g2android", "g2android"); }
public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair("g2_form[un...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
G2Client { public void loginToGallery(String galleryUrl, String user, String password) throws ImpossibleToLoginException { sessionCookies.clear(); sessionCookies.add(new BasicClientCookie("", "")); List<NameValuePair> sb = new ArrayList<NameValuePair>(); sb.add(LOGIN_CMD_NAME_VALUE_PAIR); sb.add(new BasicNameValuePair(...
@Test public void mapDraft() throws Exception { new ArrangeBuilder().withStringFromProvider("something") .withSubstitutionStringFromProvider("other something") .withFormattedDate("Some date") .withFormattedCurrency("500,00"); CreditDraft draft = CreditDataTestUtils.creditDraftTestBuilder() .id("10") .purpose("Electroni...
@NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new IllegalStateException(TAG + ": RepaymentInformation missing.")); return InRepaymentCardViewEn...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
@Test public void pendingEsignStateThrowsIllegalStateException() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Invalid draft status for in repayment card:"); CreditDraft testDraft = CreditDataTestUtils.creditDraftTestBuilder().status(PENDING_ESIGN).build(); mapper.apply(testDraft)...
@NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new IllegalStateException(TAG + ": RepaymentInformation missing.")); return InRepaymentCardViewEn...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
@Test public void waitingForDisbursementStateThrowsIllegalStateException() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Invalid draft status for in repayment card:"); CreditDraft testDraft = CreditDataTestUtils.creditDraftTestBuilder().status(WAITING_FOR_DISBURSEMENT).build(); ma...
@NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new IllegalStateException(TAG + ": RepaymentInformation missing.")); return InRepaymentCardViewEn...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
@Test public void unexpectedStateThrowsIllegalStateException() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Invalid draft status for in repayment card:"); CreditDraft testDraft = CreditDataTestUtils.creditDraftTestBuilder().status(UNEXPECTED).build(); mapper.apply(testDraft); }
@NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new IllegalStateException(TAG + ": RepaymentInformation missing.")); return InRepaymentCardViewEn...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
@Test public void displayableItemsGoIntoLiveDataWhenInteractorEmitsCreditDrafts() throws Exception { List<DisplayableItem> displayableItems = Collections.singletonList(Mockito.mock(DisplayableItem.class)); List<CreditDraft> creditDrafts = Collections.singletonList(Mockito.mock(CreditDraft.class)); arrangeBuilder.withMa...
@NonNull LiveData<List<DisplayableItem>> getCreditListLiveData() { return creditListLiveData; }
CreditDashboardViewModel extends ViewModel { @NonNull LiveData<List<DisplayableItem>> getCreditListLiveData() { return creditListLiveData; } }
CreditDashboardViewModel extends ViewModel { @NonNull LiveData<List<DisplayableItem>> getCreditListLiveData() { return creditListLiveData; } @Inject CreditDashboardViewModel(@NonNull final RetrieveCreditDraftList retrieveCreditDraftList, @NonNull final CreditDisplayableItemMapper creditDis...
CreditDashboardViewModel extends ViewModel { @NonNull LiveData<List<DisplayableItem>> getCreditListLiveData() { return creditListLiveData; } @Inject CreditDashboardViewModel(@NonNull final RetrieveCreditDraftList retrieveCreditDraftList, @NonNull final CreditDisplayableItemMapper creditDis...
CreditDashboardViewModel extends ViewModel { @NonNull LiveData<List<DisplayableItem>> getCreditListLiveData() { return creditListLiveData; } @Inject CreditDashboardViewModel(@NonNull final RetrieveCreditDraftList retrieveCreditDraftList, @NonNull final CreditDisplayableItemMapper creditDis...
@Test public void creditDraftsAreMappedToViewEntities() throws Exception { CreditDraft creditDraft = Mockito.mock(CreditDraft.class); new ArrangeBuilder().withMappedViewEntity(Mockito.mock(InRepaymentCardViewEntity.class)); displayableItemMapper.apply(Collections.singletonList(creditDraft)); Mockito.verify(viewEntityMa...
@Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) .toList() .blockingGet(); }
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
@Test public void viewEntityIsWrappedInDisplayableItem() throws Exception { CreditDraft creditDraft = Mockito.mock(CreditDraft.class); InRepaymentCardViewEntity viewEntity = Mockito.mock(InRepaymentCardViewEntity.class); new ArrangeBuilder().withMappedViewEntity(viewEntity); List<DisplayableItem> items = displayableIte...
@Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) .toList() .blockingGet(); }
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
CreditDisplayableItemMapper implements Function<List<CreditDraft>, List<DisplayableItem>> { @Override public List<DisplayableItem> apply(@NonNull final List<CreditDraft> creditDrafts) throws Exception { return Observable.fromIterable(creditDrafts) .map(inRepaymentCardViewEntityMapper) .map(this::wrapInDisplayableItem) ...
@Test public void essentialParamMissingExceptionIsThrownWhenTheMandatoryParamsAreMissing() throws Exception { thrown.expect(EssentialParamMissingException.class); thrown.expectMessage("status id purpose imageUrl"); mapper.apply(CreditDataTestUtils.creditDraftRawTestBuilder() .status(null) .id(null) .purposeName(null) ....
@Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(...
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
@Test public void amountIsMappedCorrectly() throws Exception { CreditDraftRaw raw = CreditDataTestUtils.creditDraftRawTestBuilder() .amount(10.0) .build(); CreditDraft draft = mapper.apply(raw); assertThat(draft.amount()).isEqualTo(10.0); }
@Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(...
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
@Test public void idIsMappedCorrectly() throws Exception { CreditDraftRaw raw = CreditDataTestUtils.creditDraftRawTestBuilder() .id("10") .build(); CreditDraft draft = mapper.apply(raw); assertThat(draft.id()).isEqualTo("10"); }
@Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(...
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
@Test public void purposeIsMappedCorrectly() throws Exception { CreditDraftRaw raw = CreditDataTestUtils.creditDraftRawTestBuilder() .purposeName("Electronics") .build(); CreditDraft draft = mapper.apply(raw); assertThat(draft.purpose()).isEqualTo("Electronics"); }
@Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) .status(toStatus(raw.status())) .creditRepaymentInfo(mapRepaymentInfo(...
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
CreditDraftMapper implements Function<CreditDraftRaw, CreditDraft> { @Override @SuppressWarnings("ConstantConditions") public CreditDraft apply(@NonNull final CreditDraftRaw raw) throws Exception { assertEssentialParams(raw); return CreditDraft.builder() .id(raw.id()) .purpose(raw.purposeName()) .amount(raw.amount()) ....
@Test public void missingRepaymentInfoThrows() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("RepaymentInformation missing."); CreditDraft draft = CreditDataTestUtils.creditDraftTestBuilder() .status(IN_REPAYMENT) .creditRepaymentInfo(Option.none()) .build(); mapper.apply(draft); }
@NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new IllegalStateException(TAG + ": RepaymentInformation missing.")); return InRepaymentCardViewEn...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...
InRepaymentCardViewEntityMapper implements Function<CreditDraft, InRepaymentCardViewEntity> { @NonNull public InRepaymentCardViewEntity apply(@NonNull final CreditDraft draft) throws Exception { assertCorrectStatus(draft.status()); final CreditRepaymentInfo repaymentInfo = orThrowUnsafe(draft.creditRepaymentInfo(), new...