Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial test

  • Loading branch information...
commit 3884f675e3325cb11318b3dc659175639123e1ba 1 parent 95996c1
@AlexanderWillner AlexanderWillner authored
View
2  .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
View
2  .settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
View
15 src/main/java/de/tuberlin/av/openteagle/api/UserAPI.java
@@ -0,0 +1,15 @@
+package de.tuberlin.av.openteagle.api;
+
+import java.util.List;
+
+public interface UserAPI {
+
+ public abstract List<String> getListOfVCTs();
+
+ public abstract void createVCT(String vct);
+
+ public abstract void deleteVCT(String vct);
+
+ public abstract int getNumberOfVCTs();
+
+}
View
28 src/main/java/de/tuberlin/av/openteagle/api/UserAPIMock.java
@@ -0,0 +1,28 @@
+package de.tuberlin.av.openteagle.api;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class UserAPIMock implements UserAPI {
+ private List<String> vcts = new LinkedList<String>();
+
+ @Override
+ public List<String> getListOfVCTs() {
+ return this.vcts;
+ }
+
+ @Override
+ public void createVCT(String vct) {
+ this.vcts.add(vct);
+ }
+
+ @Override
+ public void deleteVCT(String vct) {
+ this.vcts.remove(vct);
+ }
+
+ @Override
+ public int getNumberOfVCTs() {
+ return this.vcts.size();
+ }
+}
View
32 src/test/java/de/tuberlin/av/openteagle/api/TestOpenTeagleAPI.java
@@ -0,0 +1,32 @@
+package de.tuberlin.av.openteagle.api;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestOpenTeagleAPI {
+ private UserAPI openteagle;
+
+ @Before
+ public void setUp() throws Exception {
+ this.openteagle = new UserAPIMock();
+ }
+
+ @Test
+ public void createAndDeleteVCT() {
+ String vctDefinition = "";
+ int lastNumberOfVCTs = 0;
+ int currentNumberOfVCTs = 0;
+
+ lastNumberOfVCTs = this.openteagle.getNumberOfVCTs();
+ this.openteagle.createVCT(vctDefinition);
+ currentNumberOfVCTs = this.openteagle.getNumberOfVCTs();
+ Assert.assertEquals(lastNumberOfVCTs + 1, currentNumberOfVCTs);
+
+ lastNumberOfVCTs = currentNumberOfVCTs;
+ this.openteagle.deleteVCT(vctDefinition);
+ currentNumberOfVCTs = this.openteagle.getNumberOfVCTs();
+ Assert.assertEquals(lastNumberOfVCTs - 1, currentNumberOfVCTs);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.