annotate src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/impl/node/DefaultAttributesTest.java @ 75:26dfa90016d1

error delete but 2 test program commentout and not action BulletinBoard Traverser is bad
author one
date Wed, 27 Aug 2014 05:52:46 +0900
parents 7d78bbf4a9cd
children 715a9fbf02fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
1 package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.impl.node;
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
2
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
3 import java.nio.ByteBuffer;
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
4
39
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
5 import org.junit.Assert;
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
6
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
7 import fj.Ord;
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
8 import fj.P2;
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
9 import fj.data.List;
39
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
10 import fj.data.Option;
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
11 import fj.data.TreeMap;
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.AttributesTest;
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultAttributes;
75
26dfa90016d1 error delete but 2 test program commentout and not action BulletinBoard
one
parents: 39
diff changeset
14 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode;
26dfa90016d1 error delete but 2 test program commentout and not action BulletinBoard
one
parents: 39
diff changeset
15 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNodeAttribute;
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
16
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
17 public class DefaultAttributesTest extends AttributesTest
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
18 {
75
26dfa90016d1 error delete but 2 test program commentout and not action BulletinBoard
one
parents: 39
diff changeset
19 public DefaultTreeNodeAttribute instance()
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
20 {
75
26dfa90016d1 error delete but 2 test program commentout and not action BulletinBoard
one
parents: 39
diff changeset
21 List<DefaultTreeNode> rawList = List.nil();
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
22 TreeMap<String,ByteBuffer> rawMap = TreeMap.empty(Ord.stringOrd);
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
23
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
24 // add attributes
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
25
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
26 for(P2<String, ByteBuffer> entry : ENTRIES){
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
27 rawMap = rawMap.set(entry._1(),entry._2());
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
28 }
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
29
75
26dfa90016d1 error delete but 2 test program commentout and not action BulletinBoard
one
parents: 39
diff changeset
30 DefaultTreeNode node = new DefaultTreeNode(rawList,rawMap);
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
31 return node.getAttributes();
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
32 }
39
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
33
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
34 public void testGetAttributesAsRawMap()
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
35 {
75
26dfa90016d1 error delete but 2 test program commentout and not action BulletinBoard
one
parents: 39
diff changeset
36 DefaultTreeNodeAttribute attrs = instance();
39
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
37 TreeMap<String,ByteBuffer> rawMap = attrs.getAttributesAsRawMap();
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
38
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
39 // testing rawmap is not null.
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
40 Assert.assertNotNull(rawMap);
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
41
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
42 // testing rawmap has correct key values.
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
43 for(P2<String,ByteBuffer> entry : ENTRIES){
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
44 String key = entry._1();
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
45 ByteBuffer value = entry._2();
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
46
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
47 Option<ByteBuffer> option = rawMap.get(key);
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
48 if(option.isNone()){
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
49 Assert.fail();
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
50 }
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
51
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
52 ByteBuffer actual = option.some();
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
53 Assert.assertEquals(0,actual.compareTo(value));
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
54 }
7d78bbf4a9cd added some tests
Shoshi TAMAKI
parents: 38
diff changeset
55 }
38
cb9fabaedfd4 added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff changeset
56 }