From ffbea903358cf376a369987529e07d607647c41c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 24 Oct 2013 07:01:26 +0200 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20throw=20exception=20when=20remov?= =?utf8?q?ing=20a=20field=20that=20is=20not=20in=20the=20profile.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/data/Profile.java | 7 ------- src/test/java/net/pterodactylus/sone/data/ProfileTest.java | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/data/Profile.java b/src/main/java/net/pterodactylus/sone/data/Profile.java index d091b89..8c1e805 100644 --- a/src/main/java/net/pterodactylus/sone/data/Profile.java +++ b/src/main/java/net/pterodactylus/sone/data/Profile.java @@ -258,15 +258,8 @@ public class Profile implements Fingerprintable { fields.add(min(fieldIndex + 1, fields.size()), field); } - /** - * Removes the given field. - * - * @param field - * The field to remove - */ public void removeField(Field field) { checkNotNull(field, "field must not be null"); - checkArgument(hasField(field), "field must belong to this profile"); fields.remove(field); } diff --git a/src/test/java/net/pterodactylus/sone/data/ProfileTest.java b/src/test/java/net/pterodactylus/sone/data/ProfileTest.java index 33d7fff..ab68bc9 100644 --- a/src/test/java/net/pterodactylus/sone/data/ProfileTest.java +++ b/src/test/java/net/pterodactylus/sone/data/ProfileTest.java @@ -119,6 +119,13 @@ public class ProfileTest { } @Test + public void testDeletingANonExistingField() { + Field testField = profile.addField("TestField"); + profile.removeField(testField); + profile.removeField(testField); + } + + @Test public void testGettingFieldList() { Field firstField = profile.addField("First"); Field secondField = profile.addField("Second"); -- 2.7.4