Apply naming convention and add missing tests

diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodAnalyzerTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodAnalyzerTest.java
index 90f4c05..c327f6b 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodAnalyzerTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/MethodAnalyzerTest.java
@@ -57,13 +57,14 @@
 		return nextProbeId++;
 	}
 
-	// === Scenario: linear Sequence without branches ===
+	// === Scenario: linear Sequence with and without ignore filtering ===
 
 	private void createLinearSequence() {
 		final Label l0 = new Label();
 		method.visitLabel(l0);
 		method.visitLineNumber(1001, l0);
 		method.visitInsn(Opcodes.NOP);
+		method.visitInsn(Opcodes.NOP);
 		final Label l1 = new Label();
 		method.visitLabel(l1);
 		method.visitLineNumber(1002, l1);
@@ -71,33 +72,60 @@
 	}
 
 	@Test
-	public void testLinearSequenceNotCovered1() {
+	public void linear_instruction_sequence_should_create_1_probe() {
 		createLinearSequence();
 		runMethodAnalzer();
 		assertEquals(1, nextProbeId);
+	}
 
-		assertLine(1001, 1, 0, 0, 0);
+	@Test
+	public void linear_instruction_sequence_should_show_missed_when_no_probe_is_executed() {
+		createLinearSequence();
+		runMethodAnalzer();
+
+		assertLine(1001, 2, 0, 0, 0);
 		assertLine(1002, 1, 0, 0, 0);
 	}
 
 	@Test
-	public void testLinearSequenceNotCovered2() {
+	public void linear_instruction_sequence_should_show_missed_when_probearray_is_null() {
 		createLinearSequence();
 		probes = null;
 		runMethodAnalzer();
-		assertEquals(1, nextProbeId);
 
-		assertLine(1001, 1, 0, 0, 0);
+		assertLine(1001, 2, 0, 0, 0);
 		assertLine(1002, 1, 0, 0, 0);
 	}
 
 	@Test
-	public void testLinearSequenceCovered() {
+	public void linear_instruction_sequence_should_show_covered_when_probe_is_executed() {
 		createLinearSequence();
 		probes[0] = true;
 		runMethodAnalzer();
 
-		assertLine(1001, 0, 1, 0, 0);
+		assertLine(1001, 0, 2, 0, 0);
+		assertLine(1002, 0, 1, 0, 0);
+	}
+
+	/** Filters the NOP instructions as ignored */
+	private static final IFilter NOP_FILTER = new IFilter() {
+		public void filter(final String className, final String superClassName,
+				final MethodNode methodNode, final IFilterOutput output) {
+			final AbstractInsnNode i1 = methodNode.instructions.get(2);
+			final AbstractInsnNode i2 = methodNode.instructions.get(3);
+			assertEquals(Opcodes.NOP, i1.getOpcode());
+			assertEquals(Opcodes.NOP, i2.getOpcode());
+			output.ignore(i1, i2);
+		}
+	};
+
+	@Test
+	public void linear_instruction_sequence_should_ignore_instructions_when_filter_is_applied() {
+		createLinearSequence();
+		probes[0] = true;
+		runMethodAnalzer(NOP_FILTER);
+
+		assertLine(1001, 0, 0, 0, 0);
 		assertLine(1002, 0, 1, 0, 0);
 	}
 
@@ -122,10 +150,16 @@
 	}
 
 	@Test
-	public void testIfBranchNotCovered() {
+	public void if_branch_should_create_2_probes() {
 		createIfBranch();
 		runMethodAnalzer();
 		assertEquals(2, nextProbeId);
+	}
+
+	@Test
+	public void if_branch_should_show_missed_when_no_probes_are_executed() {
+		createIfBranch();
+		runMethodAnalzer();
 
 		assertLine(1001, 2, 0, 2, 0);
 		assertLine(1002, 2, 0, 0, 0);
@@ -133,7 +167,7 @@
 	}
 
 	@Test
-	public void testIfBranchCovered1() {
+	public void if_branch_should_show_partial_branch_coverage_when_probe_for_first_branch_is_executed() {
 		createIfBranch();
 		probes[0] = true;
 		runMethodAnalzer();
@@ -144,7 +178,7 @@
 	}
 
 	@Test
-	public void testIfBranchCovered2() {
+	public void if_branch_should_show_partial_branch_coverage_when_probe_for_second_branch_is_executed() {
 		createIfBranch();
 		probes[1] = true;
 		runMethodAnalzer();
@@ -155,7 +189,7 @@
 	}
 
 	@Test
-	public void testIfBranchCovered3() {
+	public void if_branch_should_show_full_branch_coverage_when_probes_for_both_branches_are_executed() {
 		createIfBranch();
 		probes[0] = true;
 		probes[1] = true;
@@ -169,7 +203,7 @@
 	// === Scenario: branch before unconditional probe ===
 
 	/**
-	 * Covers case of {@link MethodAnalyzer#visitProbe(int)} after
+	 * Covers case of
 	 * {@link MethodAnalyzer#visitJumpInsnWithProbe(int, Label, int, org.jacoco.core.internal.flow.IFrame)}.
 	 */
 	private void createIfBranchBeforeProbe() {
@@ -190,40 +224,59 @@
 	}
 
 	@Test
-	public void testIfBranchBeforeProbeNotCovered() {
+	public void if_branch_before_probes_should_create_4_probes() {
 		createIfBranchBeforeProbe();
 		runMethodAnalzer();
 		assertEquals(4, nextProbeId);
+	}
+
+	@Test
+	public void if_branch_before_probes_should_show_missed_when_no_probes_are_executed() {
+		createIfBranchBeforeProbe();
+		runMethodAnalzer();
 
 		assertLine(1001, 2, 0, 2, 0);
+		assertLine(1002, 1, 0, 0, 0);
+		assertLine(1003, 1, 0, 0, 0);
 	}
 
 	@Test
-	public void testIfBranchBeforeProbeCovered1() {
+	public void if_branch_before_probes_should_show_partial_branch_coverage_when_probe_for_first_branch_is_executed() {
 		createIfBranchBeforeProbe();
 		probes[0] = true;
+		probes[3] = true;
 		runMethodAnalzer();
 
 		assertLine(1001, 0, 2, 1, 1);
+		assertLine(1002, 1, 0, 0, 0);
+		assertLine(1003, 0, 1, 0, 0);
 	}
 
 	@Test
-	public void testIfBranchBeforeProbeCovered2() {
+	public void if_branch_before_probes_should_show_partial_branch_coverage_when_probe_for_second_branch_is_executed() {
 		createIfBranchBeforeProbe();
 		probes[1] = true;
+		probes[2] = true;
+		probes[3] = true;
 		runMethodAnalzer();
 
 		assertLine(1001, 0, 2, 1, 1);
+		assertLine(1002, 0, 1, 0, 0);
+		assertLine(1003, 0, 1, 0, 0);
 	}
 
 	@Test
-	public void testIfBranchBeforeProbeCovered3() {
+	public void if_branch_before_probes_should_show_full_branch_coverage_when_probes_for_both_branches_are_executed() {
 		createIfBranchBeforeProbe();
 		probes[0] = true;
 		probes[1] = true;
+		probes[2] = true;
+		probes[3] = true;
 		runMethodAnalzer();
 
 		assertLine(1001, 0, 2, 0, 2);
+		assertLine(1002, 0, 1, 0, 0);
+		assertLine(1003, 0, 1, 0, 0);
 	}
 
 	// === Scenario: branch which merges back ===
@@ -245,10 +298,16 @@
 	}
 
 	@Test
-	public void testIfBranchMergeNotCovered() {
+	public void if_branch_merge_should_create_3_probes() {
 		createIfBranchMerge();
 		runMethodAnalzer();
 		assertEquals(3, nextProbeId);
+	}
+
+	@Test
+	public void if_branch_merge_should_show_missed_when_no_probes_are_executed() {
+		createIfBranchMerge();
+		runMethodAnalzer();
 
 		assertLine(1001, 2, 0, 2, 0);
 		assertLine(1002, 1, 0, 0, 0);
@@ -256,7 +315,7 @@
 	}
 
 	@Test
-	public void testIfBranchMergeCovered1() {
+	public void if_branch_merge_should_show_partial_branch_coverage_when_probe_for_first_branch_is_executed() {
 		createIfBranchMerge();
 		probes[0] = true;
 		runMethodAnalzer();
@@ -267,7 +326,7 @@
 	}
 
 	@Test
-	public void testIfBranchMergeCovered2() {
+	public void if_branch_merge_should_show_partial_branch_coverage_when_probe_for_second_branch_is_executed() {
 		createIfBranchMerge();
 		probes[1] = true;
 		runMethodAnalzer();
@@ -278,7 +337,7 @@
 	}
 
 	@Test
-	public void testIfBranchMergeCovered3() {
+	public void if_branch_merge_should_show_full_branch_coverage_when_probes_for_both_branches_are_executed() {
 		createIfBranchMerge();
 		probes[0] = true;
 		probes[1] = true;
@@ -290,7 +349,7 @@
 		assertLine(1003, 0, 1, 0, 0);
 	}
 
-	// === Scenario: branch which jump backwards ===
+	// === Scenario: branch which jumps backwards ===
 
 	private void createJumpBackwards() {
 		final Label l0 = new Label();
@@ -308,10 +367,16 @@
 	}
 
 	@Test
-	public void testJumpBackwardsNotCovered() {
+	public void jump_backwards_should_create_1_probe() {
 		createJumpBackwards();
 		runMethodAnalzer();
 		assertEquals(1, nextProbeId);
+	}
+
+	@Test
+	public void jump_backwards_should_show_missed_when_no_probes_are_executed() {
+		createJumpBackwards();
+		runMethodAnalzer();
 
 		assertLine(1001, 1, 0, 0, 0);
 		assertLine(1002, 1, 0, 0, 0);
@@ -319,7 +384,7 @@
 	}
 
 	@Test
-	public void testJumpBackwardsCovered() {
+	public void jump_backwards_should_show_covered_when_probe_is_executed() {
 		createJumpBackwards();
 		probes[0] = true;
 		runMethodAnalzer();
@@ -346,33 +411,37 @@
 	}
 
 	@Test
-	public void testJumpToFirstNotCovered() {
+	public void jump_to_first_instruction_should_create_2_probes() {
 		createJumpToFirst();
 		runMethodAnalzer();
 		assertEquals(2, nextProbeId);
+	}
+
+	@Test
+	public void jump_to_first_instruction_should_show_missed_when_no_probes_are_executed() {
+		createJumpToFirst();
+		runMethodAnalzer();
 
 		assertLine(1001, 3, 0, 2, 0);
 		assertLine(1002, 1, 0, 0, 0);
 	}
 
 	@Test
-	public void testJumpToFirstCovered1() {
+	public void jump_to_first_instruction_should_show_partial_branch_coverage_when_probe_for_first_branch_is_executed() {
 		createJumpToFirst();
 		probes[0] = true;
 		runMethodAnalzer();
-		assertEquals(2, nextProbeId);
 
 		assertLine(1001, 0, 3, 1, 1);
 		assertLine(1002, 1, 0, 0, 0);
 	}
 
 	@Test
-	public void testJumpToFirstCovered2() {
+	public void jump_to_first_instruction_should_show_full_branch_coverage_when_probes_for_both_branches_are_executed() {
 		createJumpToFirst();
 		probes[0] = true;
 		probes[1] = true;
 		runMethodAnalzer();
-		assertEquals(2, nextProbeId);
 
 		assertLine(1001, 0, 3, 0, 2);
 		assertLine(1002, 0, 1, 0, 0);
@@ -417,10 +486,16 @@
 	}
 
 	@Test
-	public void testTableSwitchNotCovered() {
+	public void table_switch_should_create_4_probes() {
 		createTableSwitch();
 		runMethodAnalzer();
 		assertEquals(4, nextProbeId);
+	}
+
+	@Test
+	public void table_switch_should_show_missed_when_no_probes_are_executed() {
+		createTableSwitch();
+		runMethodAnalzer();
 
 		assertLine(1001, 2, 0, 3, 0);
 		assertLine(1002, 2, 0, 0, 0);
@@ -432,12 +507,11 @@
 	}
 
 	@Test
-	public void testTableSwitchCovered1() {
+	public void table_switch_should_show_partial_branch_coverage_when_probes_for_first_branch_and_default_are_executed() {
 		createTableSwitch();
 		probes[0] = true;
 		probes[3] = true;
 		runMethodAnalzer();
-		assertEquals(4, nextProbeId);
 
 		assertLine(1001, 0, 2, 2, 1);
 		assertLine(1002, 0, 2, 0, 0);
@@ -449,12 +523,11 @@
 	}
 
 	@Test
-	public void testTableSwitchCovered2() {
+	public void table_switch_should_show_partial_branch_coverage_when_probes_for_third_branch_and_default_are_executed() {
 		createTableSwitch();
 		probes[2] = true;
 		probes[3] = true;
 		runMethodAnalzer();
-		assertEquals(4, nextProbeId);
 
 		assertLine(1001, 0, 2, 2, 1);
 		assertLine(1002, 2, 0, 0, 0);
@@ -466,14 +539,13 @@
 	}
 
 	@Test
-	public void testTableSwitchCovered3() {
+	public void table_switch_should_show_full_branch_coverage_when_all_probes_are_executed() {
 		createTableSwitch();
 		probes[0] = true;
 		probes[1] = true;
 		probes[2] = true;
 		probes[3] = true;
 		runMethodAnalzer();
-		assertEquals(4, nextProbeId);
 
 		assertLine(1001, 0, 2, 0, 3);
 		assertLine(1002, 0, 2, 0, 0);
@@ -513,10 +585,16 @@
 	}
 
 	@Test
-	public void testTableSwitchMergeNotCovered() {
+	public void table_switch_with_merge_should_create_5_probes() {
 		createTableSwitchMerge();
 		runMethodAnalzer();
 		assertEquals(5, nextProbeId);
+	}
+
+	@Test
+	public void table_switch_with_merge_should_show_missed_when_no_probes_are_executed() {
+		createTableSwitchMerge();
+		runMethodAnalzer();
 
 		assertLine(1001, 2, 0, 0, 0);
 		assertLine(1002, 2, 0, 3, 0);
@@ -526,12 +604,11 @@
 	}
 
 	@Test
-	public void testTableSwitchMergeNotCovered1() {
+	public void table_switch_with_merge_should_show_two_missed_cases_when_probes_for_these_branches_are_not_executed() {
 		createTableSwitchMerge();
 		probes[0] = true;
 		probes[4] = true;
 		runMethodAnalzer();
-		assertEquals(5, nextProbeId);
 
 		assertLine(1001, 0, 2, 0, 0);
 		assertLine(1002, 0, 2, 2, 1);
@@ -541,13 +618,12 @@
 	}
 
 	@Test
-	public void testTableSwitchMergeNotCovered2() {
+	public void table_switch_with_merge_should_show_one_missed_case_when_probe_for_this_branch_is_not_executed() {
 		createTableSwitchMerge();
 		probes[1] = true;
 		probes[3] = true;
 		probes[4] = true;
 		runMethodAnalzer();
-		assertEquals(5, nextProbeId);
 
 		assertLine(1001, 0, 2, 0, 0);
 		assertLine(1002, 0, 2, 2, 1);
@@ -557,13 +633,12 @@
 	}
 
 	@Test
-	public void testTableSwitchMergeNotCovered3() {
+	public void table_switch_with_merge_should_show_partial_branch_coverage_when_probe_for_one_branch_is_not_executed() {
 		createTableSwitchMerge();
 		probes[2] = true;
 		probes[3] = true;
 		probes[4] = true;
 		runMethodAnalzer();
-		assertEquals(5, nextProbeId);
 
 		assertLine(1001, 0, 2, 0, 0);
 		assertLine(1002, 0, 2, 2, 1);
@@ -573,7 +648,7 @@
 	}
 
 	@Test
-	public void testTableSwitchMergeNotCovered4() {
+	public void table_switch_with_merge_should_show_full_branch_coverage_when_all_probes_are_executed() {
 		createTableSwitchMerge();
 		probes[0] = true;
 		probes[1] = true;
@@ -581,7 +656,6 @@
 		probes[3] = true;
 		probes[4] = true;
 		runMethodAnalzer();
-		assertEquals(5, nextProbeId);
 
 		assertLine(1001, 0, 2, 0, 0);
 		assertLine(1002, 0, 2, 0, 3);
@@ -609,40 +683,54 @@
 		method.visitLineNumber(1002, l3);
 		method.visitVarInsn(Opcodes.ASTORE, 1);
 		method.visitLabel(l4);
-		method.visitLineNumber(1004, l4);
+		method.visitLineNumber(1003, l4);
 		method.visitInsn(Opcodes.RETURN);
 	}
 
 	@Test
-	public void testTryCatchBlockNotCovered() {
+	public void try_catch_should_create_3_probes() {
 		createTryCatchBlock();
 		runMethodAnalzer();
 		assertEquals(3, nextProbeId);
-		assertEquals(CounterImpl.getInstance(5, 0),
-				result.getInstructionCounter());
-
-		assertLine(1001, 3, 0, 0, 0);
-		assertLine(1002, 1, 0, 0, 0);
-		assertLine(1004, 1, 0, 0, 0);
 	}
 
 	@Test
-	public void testTryCatchBlockFullyCovered() {
+	public void try_catch_should_should_show_missed_when_no_probes_are_executed() {
+		createTryCatchBlock();
+		runMethodAnalzer();
+
+		assertLine(1001, 3, 0, 0, 0);
+		assertLine(1002, 1, 0, 0, 0);
+		assertLine(1003, 1, 0, 0, 0);
+	}
+
+	@Test
+	public void try_catch_should_should_show_exception_handler_missed_when_probe_is_not_executed() {
+		createTryCatchBlock();
+		probes[0] = true;
+		probes[1] = true;
+		probes[0] = true;
+		runMethodAnalzer();
+
+		assertLine(1001, 0, 3, 0, 0);
+		assertLine(1002, 0, 1, 0, 0);
+		assertLine(1003, 1, 0, 0, 0);
+	}
+
+	@Test
+	public void try_catch_should_should_show_all_covered_when_all_probes_are_executed() {
 		createTryCatchBlock();
 		probes[0] = true;
 		probes[1] = true;
 		probes[2] = true;
 		runMethodAnalzer();
-		assertEquals(3, nextProbeId);
-		assertEquals(CounterImpl.getInstance(0, 5),
-				result.getInstructionCounter());
 
 		assertLine(1001, 0, 3, 0, 0);
 		assertLine(1002, 0, 1, 0, 0);
-		assertLine(1004, 0, 1, 0, 0);
+		assertLine(1003, 0, 1, 0, 0);
 	}
 
-	// === Scenario: try/finally ===
+	// === Scenario: try/finally with and without merge filtering ===
 
 	private void createTryFinally() {
 		final Label l0 = new Label();
@@ -672,12 +760,18 @@
 	}
 
 	@Test
-	public void testTryFinallyWithoutFilter() {
+	public void try_finally_should_create_4_probes() {
+		createTryFinally();
+		runMethodAnalzer();
+		assertEquals(4, nextProbeId);
+	}
+
+	@Test
+	public void try_finally_without_filter_should_show_all_branches() {
 		createTryFinally();
 		probes[0] = true;
 		probes[3] = true;
 		runMethodAnalzer();
-		assertEquals(4, nextProbeId);
 
 		assertLine(1001, 2, 4, 2, 2);
 	}
@@ -696,7 +790,7 @@
 	};
 
 	@Test
-	public void testTryFinallyMergeSameBranch() {
+	public void try_finally_with_filter_should_show_partial_branch_coverage_when_same_branch_is_covered_and_merged() {
 		createTryFinally();
 		probes[0] = true;
 		probes[2] = true;
@@ -705,7 +799,7 @@
 	}
 
 	@Test
-	public void testTryFinallyMergeDifferentBranches() {
+	public void try_finally_with_filter_should_show_full_branch_coverage_when_different_branches_are_covered_and_merged() {
 		createTryFinally();
 		probes[0] = true;
 		probes[3] = true;
@@ -713,6 +807,38 @@
 		assertLine(1001, 2, 3, 0, 2);
 	}
 
+	// === Scenario: descending line numbers ===
+
+	private void createDescendingLineNumbers() {
+		final Label l0 = new Label();
+		method.visitLabel(l0);
+		method.visitLineNumber(1003, l0);
+		method.visitInsn(Opcodes.NOP);
+		method.visitInsn(Opcodes.NOP);
+		method.visitInsn(Opcodes.NOP);
+		final Label l1 = new Label();
+		method.visitLabel(l1);
+		method.visitLineNumber(1002, l1);
+		method.visitInsn(Opcodes.NOP);
+		method.visitInsn(Opcodes.NOP);
+		final Label l2 = new Label();
+		method.visitLabel(l2);
+		method.visitLineNumber(1001, l2);
+		method.visitInsn(Opcodes.RETURN);
+	}
+
+	@Test
+	public void decending_line_numbers_should_report_lines_correctly() {
+		createDescendingLineNumbers();
+		runMethodAnalzer();
+
+		assertEquals(1001, result.getFirstLine());
+		assertEquals(1003, result.getLastLine());
+		assertLine(1001, 1, 0, 0, 0);
+		assertLine(1002, 2, 0, 0, 0);
+		assertLine(1003, 3, 0, 0, 0);
+	}
+
 	private void runMethodAnalzer() {
 		runMethodAnalzer(Filters.NONE);
 	}
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
index 0be4715..5a7239e 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
@@ -405,7 +405,7 @@
 		final Instruction instruction;
 		final int branch;
 
-		private CoveredProbe(Instruction instruction, int branch) {
+		private CoveredProbe(final Instruction instruction, final int branch) {
 			this.instruction = instruction;
 			this.branch = branch;
 		}