I also suggest you process the line(s) in a method so you can write tests with lots of different input without having to call/stub apt-cache.