From 1cbaec4d46e43dd37ed6ccb210b9ba4368fcad71 Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Mon, 25 Apr 2016 23:58:33 +0200 Subject: [PATCH] Tester.testExtraZPMs() fixed --- cicaprojekt/Tester.java | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/cicaprojekt/Tester.java b/cicaprojekt/Tester.java index ed23c43..05e8b62 100644 --- a/cicaprojekt/Tester.java +++ b/cicaprojekt/Tester.java @@ -108,6 +108,12 @@ public class Tester { return blue + " " + yellow + " " + red + " " + green; } + String getConnectedGateOpen(Scale s){ + if(s.getGateConnected().isOpen()) + return "gate open"; + else return "gate closed"; + } + /* custom Test annotation */ @Target(ElementType.METHOD) // it's for methods @Retention(RetentionPolicy.RUNTIME) // we want to retain annotations in runtime @@ -185,43 +191,19 @@ public class Tester { return succes; } - @Test - boolean testExtraZPM(){ - String[] commands = {"loadMap testExtraZPMs\n", - "listZPMs\n", - "move O\n", - "move O\n", - "listZPMs\n"}; - - String[] expectedOutputs = {}; - - loadMap("testExtraZPMs"); - - boolean results = testOnSequenceOfCommands(commands, expectedOutputs); - - System.out.print("testExtraZPMs: "); - if(results) - System.out.println("Sikeres!"); - else System.out.println("Sikertelen!"); - - return results; - } - boolean testScalesAndGates() throws IOException { boolean succes = true; - String[] commands = {"loadMap testScalesAndGates\n", - "boxLift O\n", - "rotate O L\n", - "boxDrop O\n"}; - - String[] expectedOutputs = {"door open\n"}; - loadMap("testScalesAndGates"); boxLift("O"); rotate("O", "L"); boxDrop("O"); + String gateOpen = getConnectedGateOpen((Scale)oneill.getCurrentTile().getAdjacentTile(oneill.facingDirection)); + + if(!gateOpen.equals("gate open")) + succes = false; + System.out.print("testScalesAndGates: "); if(succes) System.out.println("Sikeres!");