MatrixBerryCore
TestSuiteStaticProp.m
Go to the documentation of this file.
1 classdef TestSuiteStaticProp < matlab.unittest.TestCase
2  methods
3  function self = TestSuiteStaticProp(varargin)
4  self = self@matlab.unittest.TestCase(varargin{:});
5  end
6  end
7  methods (TestMethodSetup)
8  function self = setUp(self)
9  mxberry.core.obj.test.StaticPropStorage.flush();
10  mxberry.core.obj.test.StaticPropStorage2.flush();
11  end
12  end
13  methods (Test)
14  function self=test_separation(self)
15  mxberry.core.obj.test.StaticPropStorage.setProp('alpha',1);
16  mxberry.core.obj.test.StaticPropStorage.setProp('beta',11);
17  mxberry.core.obj.test.StaticPropStorage2.setProp('alpha',2);
18  mxberry.core.obj.test.StaticPropStorage2.setProp('beta',22);
19  self.verifyEqual(1,...
20  mxberry.core.obj.test.StaticPropStorage.getProp('alpha'));
21  %
22  self.verifyEqual(2,...
23  mxberry.core.obj.test.StaticPropStorage2.getProp('alpha'));
24  self.verifyEqual(11,...
25  mxberry.core.obj.test.StaticPropStorage.getProp('beta'));
26  %
27  self.verifyEqual(22,...
28  mxberry.core.obj.test.StaticPropStorage2.getProp('beta'));
29  end
30  function self=test_checkPresence(self)
31  mxberry.core.obj.test.StaticPropStorage.setProp('alpha',1);
32  mxberry.core.obj.test.StaticPropStorage2.setProp('beta',11);
33  %
34  [resVal,isThere]=mxberry.core.obj.test.StaticPropStorage2.getProp('beta',true);
35  self.verifyEqual(true,isThere);
36  self.verifyEqual(11,resVal);
37  %
38  [resVal,isThere]=mxberry.core.obj.test.StaticPropStorage2.getProp('beta2',true);
39  self.verifyEqual(true,isempty(resVal));
40  self.verifyEqual(false,isThere);
41  %
42  [resVal,isThere]=mxberry.core.obj.test.StaticPropStorage.getProp('alpha',true);
43  self.verifyEqual(true,isThere);
44  self.verifyEqual(1,resVal);
45  %
46  [resVal,isThere]=mxberry.core.obj.test.StaticPropStorage.getProp('alpha2',true);
47  self.verifyEqual(false,isThere);
48  self.verifyEqual(true,isempty(resVal));
49  %
50  try
51  [~,~]=mxberry.core.obj.test.StaticPropStorage.getProp('alpha2');
52  catch meObj
53  self.aux_checkNoPropException(meObj);
54  end
55  try
56  [~,~]=mxberry.core.obj.test.StaticPropStorage.getProp('alpha2',false);
57  catch meObj
58  self.aux_checkNoPropException(meObj);
59  end
60 
61  end
62  end
63  methods
64  function aux_checkNoPropException(self,meObj)
65  self.verifyEqual(true,~isempty(strfind(...
66  meObj.identifier,':noProp')));
67  end
68 
69  end
70 end