Add method to set the value of a field.
[Sone.git] / src / test / java / net / pterodactylus / sone / data / ProfileTest.java
index 4f81966..0fcb80e 100644 (file)
@@ -19,6 +19,7 @@ package net.pterodactylus.sone.data;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 
 import net.pterodactylus.sone.data.Profile.Field;
 
@@ -34,6 +35,14 @@ public class ProfileTest {
        final Profile profile = new Profile((Sone) null);
 
        @Test
+       public void testAddingAField() {
+               profile.addField("TestField");
+               Field testField = profile.getFieldByName("TestField");
+               assertThat(testField, notNullValue());
+               assertThat(testField.getName(), is("TestField"));
+       }
+
+       @Test
        public void testRenamingAField() {
                profile.addField("TestField");
                Field testField = profile.getFieldByName("TestField");
@@ -42,4 +51,13 @@ public class ProfileTest {
                assertThat(testField.getId(), is(renamedField.getId()));
        }
 
+       @Test
+       public void testChangingTheValueOfAField() {
+               profile.addField("TestField");
+               Field testField = profile.getFieldByName("TestField");
+               profile.setField(testField, "Test");
+               testField = profile.getFieldByName("TestField");
+               assertThat(testField.getValue(), is("Test"));
+       }
+
 }