Mercurial > hg > Members > tatsuki > bench > jungle-core
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 |
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 | 5 import org.junit.Assert; |
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 | 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 | 33 |
34 public void testGetAttributesAsRawMap() | |
35 { | |
75
26dfa90016d1
error delete but 2 test program commentout and not action BulletinBoard
one
parents:
39
diff
changeset
|
36 DefaultTreeNodeAttribute attrs = instance(); |
39 | 37 TreeMap<String,ByteBuffer> rawMap = attrs.getAttributesAsRawMap(); |
38 | |
39 // testing rawmap is not null. | |
40 Assert.assertNotNull(rawMap); | |
41 | |
42 // testing rawmap has correct key values. | |
43 for(P2<String,ByteBuffer> entry : ENTRIES){ | |
44 String key = entry._1(); | |
45 ByteBuffer value = entry._2(); | |
46 | |
47 Option<ByteBuffer> option = rawMap.get(key); | |
48 if(option.isNone()){ | |
49 Assert.fail(); | |
50 } | |
51 | |
52 ByteBuffer actual = option.some(); | |
53 Assert.assertEquals(0,actual.compareTo(value)); | |
54 } | |
55 } | |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
56 } |