@Test (expected = NullPointerException.class) public void testSetNullTileIDs () { TiledLayer layer = new TiledLayer("test", 10, 20, 1, true, 30, 40, 1, 1); layer.setTileIDs(null); }
public void setTileIDs(int[] tileIDs) { if (tileIDs == null) { throw new NullPointerException("tileIDs cannot be null."); } if (tileIDs.length != this.width * this.height) { throw new IllegalArgumentException("length of array does not fit with width & height, expected length: " + (this.width * this.height) + ", current length: " + tileIDs.length); } this.tileIDs = tileIDs; }
TiledLayer implements Comparable<TiledLayer> { public void setTileIDs(int[] tileIDs) { if (tileIDs == null) { throw new NullPointerException("tileIDs cannot be null."); } if (tileIDs.length != this.width * this.height) { throw new IllegalArgumentException("length of array does not fit with width & height, expected length: " + (this.width * this.height) + ", current length: " + tileIDs.length); } this.tileIDs = tileIDs; } }
TiledLayer implements Comparable<TiledLayer> { public void setTileIDs(int[] tileIDs) { if (tileIDs == null) { throw new NullPointerException("tileIDs cannot be null."); } if (tileIDs.length != this.width * this.height) { throw new IllegalArgumentException("length of array does not fit with width & height, expected length: " + (this.width * this.height) + ", current length: " + tileIDs.length); } this.tileIDs = tileIDs; } TiledLayer(String name, int width, int height, float opacity, boolean visible, float offsetx, float offsety, int floor, int renderOrder); }
TiledLayer implements Comparable<TiledLayer> { public void setTileIDs(int[] tileIDs) { if (tileIDs == null) { throw new NullPointerException("tileIDs cannot be null."); } if (tileIDs.length != this.width * this.height) { throw new IllegalArgumentException("length of array does not fit with width & height, expected length: " + (this.width * this.height) + ", current length: " + tileIDs.length); } this.tileIDs = tileIDs; } TiledLayer(String name, int width, int height, float opacity, boolean visible, float offsetx, float offsety, int floor, int renderOrder); void setTileIDs(int[] tileIDs); void addBoolProperty(String key, boolean value); void addIntProperty(String key, int value); void addFloatProperty(String key, float value); void addStringProperty(String key, String value); String getName(); int getWidth(); int getHeight(); float getOpacity(); boolean isVisible(); float getOffsetx(); float getOffsety(); int[] getTileIDs(); int getFloor(); int getRenderOrder(); @Override int compareTo(TiledLayer o); }
TiledLayer implements Comparable<TiledLayer> { public void setTileIDs(int[] tileIDs) { if (tileIDs == null) { throw new NullPointerException("tileIDs cannot be null."); } if (tileIDs.length != this.width * this.height) { throw new IllegalArgumentException("length of array does not fit with width & height, expected length: " + (this.width * this.height) + ", current length: " + tileIDs.length); } this.tileIDs = tileIDs; } TiledLayer(String name, int width, int height, float opacity, boolean visible, float offsetx, float offsety, int floor, int renderOrder); void setTileIDs(int[] tileIDs); void addBoolProperty(String key, boolean value); void addIntProperty(String key, int value); void addFloatProperty(String key, float value); void addStringProperty(String key, String value); String getName(); int getWidth(); int getHeight(); float getOpacity(); boolean isVisible(); float getOffsetx(); float getOffsety(); int[] getTileIDs(); int getFloor(); int getRenderOrder(); @Override int compareTo(TiledLayer o);  }