@@ -103,18 +103,18 @@ public void testNamespaceDeleteItem() {
103
103
public void testChildNamespaceModified () {
104
104
long childNamespaceId = 1 , parentNamespaceId = 2 ;
105
105
Namespace childNamespace = createNamespace (childNamespaceId );
106
- Namespace parentNamespace = createNamespace (childNamespaceId );
106
+ Namespace parentNamespace = createNamespace (parentNamespaceId );
107
107
108
108
Release childRelease = createRelease ("{\" k1\" :\" v1\" , \" k2\" :\" v2\" }" );
109
109
List <Item > childItems = Arrays .asList (createItem ("k1" , "v3" ));
110
- List < Item > parentItems = Arrays . asList ( createItem ( "k1" , "v1" ), createItem ( "k2" , "v2" ) );
110
+ Release parentRelease = createRelease ( "{ \" k1 \" : \ " v1\" , \ " k2\" : \ " v2\" }" );
111
111
112
112
when (releaseService .findLatestActiveRelease (childNamespace )).thenReturn (childRelease );
113
+ when (releaseService .findLatestActiveRelease (parentNamespace )).thenReturn (parentRelease );
113
114
when (itemService .findItems (childNamespaceId )).thenReturn (childItems );
114
- when (itemService .findItems (parentNamespaceId )).thenReturn (parentItems );
115
- when (namespaceService .findParentNamespace (parentNamespace )).thenReturn (parentNamespace );
115
+ when (namespaceService .findParentNamespace (childNamespace )).thenReturn (parentNamespace );
116
116
117
- boolean isModified = namespaceUnlockAspect .isModified (parentNamespace );
117
+ boolean isModified = namespaceUnlockAspect .isModified (childNamespace );
118
118
119
119
Assert .assertTrue (isModified );
120
120
}
@@ -123,18 +123,37 @@ public void testChildNamespaceModified() {
123
123
public void testChildNamespaceNotModified () {
124
124
long childNamespaceId = 1 , parentNamespaceId = 2 ;
125
125
Namespace childNamespace = createNamespace (childNamespaceId );
126
- Namespace parentNamespace = createNamespace (childNamespaceId );
126
+ Namespace parentNamespace = createNamespace (parentNamespaceId );
127
127
128
- Release childRelease = createRelease ("{\" k1\" :\" v1\" , \" k2\" :\" v2\" }" );
129
- List <Item > childItems = Arrays .asList (createItem ("k1" , "v1" ));
130
- List <Item > parentItems = Arrays .asList (createItem ("k2" , "v2" ));
128
+ Release childRelease = createRelease ("{\" k1\" :\" v3\" , \" k2\" :\" v2\" }" );
129
+ List <Item > childItems = Arrays .asList (createItem ("k1" , "v3" ));
130
+ Release parentRelease = createRelease ("{\" k1\" :\" v1\" , \" k2\" :\" v2\" }" );
131
+
132
+ when (releaseService .findLatestActiveRelease (childNamespace )).thenReturn (childRelease );
133
+ when (releaseService .findLatestActiveRelease (parentNamespace )).thenReturn (parentRelease );
134
+ when (itemService .findItems (childNamespaceId )).thenReturn (childItems );
135
+ when (namespaceService .findParentNamespace (childNamespace )).thenReturn (parentNamespace );
136
+
137
+ boolean isModified = namespaceUnlockAspect .isModified (childNamespace );
138
+
139
+ Assert .assertFalse (isModified );
140
+ }
141
+
142
+ @ Test
143
+ public void testParentNamespaceNotReleased () {
144
+ long childNamespaceId = 1 , parentNamespaceId = 2 ;
145
+ Namespace childNamespace = createNamespace (childNamespaceId );
146
+ Namespace parentNamespace = createNamespace (parentNamespaceId );
147
+
148
+ Release childRelease = createRelease ("{\" k1\" :\" v3\" , \" k2\" :\" v2\" }" );
149
+ List <Item > childItems = Arrays .asList (createItem ("k1" , "v2" ), createItem ("k2" , "v2" ));
131
150
132
151
when (releaseService .findLatestActiveRelease (childNamespace )).thenReturn (childRelease );
152
+ when (releaseService .findLatestActiveRelease (parentNamespace )).thenReturn (null );
133
153
when (itemService .findItems (childNamespaceId )).thenReturn (childItems );
134
- when (itemService .findItems (parentNamespaceId )).thenReturn (parentItems );
135
- when (namespaceService .findParentNamespace (parentNamespace )).thenReturn (parentNamespace );
154
+ when (namespaceService .findParentNamespace (childNamespace )).thenReturn (parentNamespace );
136
155
137
- boolean isModified = namespaceUnlockAspect .isModified (parentNamespace );
156
+ boolean isModified = namespaceUnlockAspect .isModified (childNamespace );
138
157
139
158
Assert .assertTrue (isModified );
140
159
}
0 commit comments