Skip to content

Commit

Permalink
Unit test debug output to increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Nov 1, 2016
1 parent 3aa72cc commit 3390213
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Expand Up @@ -63,4 +63,11 @@ public void runAllFieldsTests() {
UserAgentAnalyzerTester uaa = new UserAgentAnalyzerTester("classpath*:AllFields-tests.yaml");
Assert.assertTrue(uaa.runTests(false, true));
}

@Test
public void runDebugOutputTest() {
UserAgentAnalyzerTester uaa = new UserAgentAnalyzerTester("classpath*:DebugOutput-tests.yaml");
Assert.assertTrue(uaa.runTests(false, true));
}

}
41 changes: 41 additions & 0 deletions analyzer/src/test/resources/DebugOutput-tests.yaml
@@ -0,0 +1,41 @@
#
# Yet Another UserAgent Analyzer
# Copyright (C) 2013-2016 Niels Basjes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

config:
- lookup:
name: 'Dummy'
map:
"Nothing": "to see here"

- matcher:
options:
- 'verbose'
require:
- 'LookUp[Dummy;agent.(1)product.(1)name;"Fake"]'
- 'IsNull[agent.(1)product.(1)name^.name="Word"!="Other"^.name[1]@{"Start"}"End"@@[-1][2-3][3-]<><]'
- 'IsNull[agent.(1)product.(1)name^.name="Bla"]'
extract:
- 'WordMatchFlipFlop: 1:agent.(1)product.(1)comments.(1-3)entry.(1)text[-1]="One"@[3]="Three"@[2]'

- test:
options:
- 'verbose'
input:
name: 'Validate Debug Output looks good'
user_agent_string: 'Word/1 ( One Two Three )'
expected:
WordMatchFlipFlop: 'Two'

0 comments on commit 3390213

Please sign in to comment.