@@ -103,18 +103,18 @@ public void testNamespaceDeleteItem() {
103103 public void testChildNamespaceModified () {
104104 long childNamespaceId = 1 , parentNamespaceId = 2 ;
105105 Namespace childNamespace = createNamespace (childNamespaceId );
106- Namespace parentNamespace = createNamespace (childNamespaceId );
106+ Namespace parentNamespace = createNamespace (parentNamespaceId );
107107
108108 Release childRelease = createRelease ("{\" k1\" :\" v1\" , \" k2\" :\" v2\" }" );
109109 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\" }" );
111111
112112 when (releaseService .findLatestActiveRelease (childNamespace )).thenReturn (childRelease );
113+ when (releaseService .findLatestActiveRelease (parentNamespace )).thenReturn (parentRelease );
113114 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 );
116116
117- boolean isModified = namespaceUnlockAspect .isModified (parentNamespace );
117+ boolean isModified = namespaceUnlockAspect .isModified (childNamespace );
118118
119119 Assert .assertTrue (isModified );
120120 }
@@ -123,18 +123,37 @@ public void testChildNamespaceModified() {
123123 public void testChildNamespaceNotModified () {
124124 long childNamespaceId = 1 , parentNamespaceId = 2 ;
125125 Namespace childNamespace = createNamespace (childNamespaceId );
126- Namespace parentNamespace = createNamespace (childNamespaceId );
126+ Namespace parentNamespace = createNamespace (parentNamespaceId );
127127
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" ));
131150
132151 when (releaseService .findLatestActiveRelease (childNamespace )).thenReturn (childRelease );
152+ when (releaseService .findLatestActiveRelease (parentNamespace )).thenReturn (null );
133153 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 );
136155
137- boolean isModified = namespaceUnlockAspect .isModified (parentNamespace );
156+ boolean isModified = namespaceUnlockAspect .isModified (childNamespace );
138157
139158 Assert .assertTrue (isModified );
140159 }
0 commit comments