Gaffer icon indicating copy to clipboard operation
Gaffer copied to clipboard

Refactor unit tests which use Schemas

Open t616178 opened this issue 7 years ago • 4 comments

Currently there is a lot of repetition in our test classes for the creation and use of schemas - this should be refactored to encourage reuse.

t616178 avatar Nov 22 '17 10:11 t616178

This task should be tackled piecemeal after the implementation of gh-1833.

t616178 avatar Feb 07 '18 11:02 t616178

@t92549 @t511203 Our tests have undergone some changes over the years so is this still relevant? "Currently there is a lot of repetition in our test classes for the creation and use of schemas - this should be refactored to encourage reuse."

n3101 avatar Nov 17 '21 15:11 n3101

@n3101 I think this is still relevant. This kind of relates to a whole load of ideas described in https://github.com/gchq/Gaffer/issues/1833. Ideas which I have been toying with recently and I didn't realise were documented anywhere by someone else. As described, it fits into a piece of work that starts with #1867

t92549 avatar Nov 17 '21 15:11 t92549

An additional problem with use of schemas is that various unit tests in Graph and Store make the assumption that the schema used to create a store will be the same as the schema returned by getSchema when it is actually getOriginalSchema which is guaranteed to return this. The getOriginalSchema method only works in combination with a Graph and remains null if only a Store has been created.

Therefore there are unit tests which use mocking to create behaviour which differs from the actual behaviour. This should be fixed as part of any refactor.

GCHQDeveloper314 avatar Feb 08 '23 14:02 GCHQDeveloper314